hyperapp-redux-devtools icon indicating copy to clipboard operation
hyperapp-redux-devtools copied to clipboard

Re-rendering called on getState action with hyperapp-redux-devtools

Open tetradice opened this issue 7 years ago • 0 comments

Hi. Always helped with this tool.

Please let me report one. When I used this tool in conjunction with hyperapp V1 I found one where the behavior changes.

import { app, h } from "hyperapp";
import devtools from "hyperapp-redux-devtools";

var actions = {
    getState: () => (state) => state
};

var view = (state, actions) => {
    console.log("RENDERING");
    return <div>Hello world. <button onclick={(e) => actions.getState()}>GetState</button></div>
}

devtools(app)({}, actions, view, document.getElementById('MAIN'));

In the above code, we use the "getState" pattern illustrated by the official README.

Executing the above code and pressing the "GetState" button will output "RENDERING" to the console each time. If I change the state not using devtools, "RENDERING" will not be output even if I do the same operation.

This difference can cause unnecessary updates to the view. It will be helpful if you can fix it if possible.

tetradice avatar Jan 20 '19 06:01 tetradice