-
Notifications
You must be signed in to change notification settings - Fork 16
Should detect whole state spreading #5
Copy link
Copy link
Open
Description
With a given code
const mapState = ({ page, direction, ...state }) => ({
page,
direction,
isLoading: isLoading(state)
})memoize state should not react to any state change, as it would.
Posible solutions:
-
Currently, memoize react on key
get, but it could react on keyread. This will require all objects to be wrapped by something with valueOf/toString. They key will be added to tracking if someone "read" it, or "return" it.
Could affect performance. Unstable. -
Track such situations and encourage a user to change the code
- cast function to string, and search for spread operator (unstable)
- detect then all keys of state used, and inform user of a potential problem. Easy to do, could be enabled by default in dev mode.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels