Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Provider<A extends Action = AnyAction>({
}
}, [store, serverState])

const previousState = useMemo(() => store.getState(), [store])
const previousState = useMemo(store.getState, [store])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that it breaks custom stores that rely on this. A test covering this use case was originally introduced here and fixed this issue

Given how rare of a use case this is and the allocation cost that this requires for all users I would say that it would be better to drop support for this use case and require users who need this to bind their stores appropriately. It's an easy thing to do and feels to me like something that can be easily handled in the userland.

OTOH Provider itself is, at least currently, usually not rendered often as it lives "on the top" of the app. So kinda 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically Provider is only ever going to render once in an app anyway. Given that, I'm not sure this change really provides any benefit :)


useIsomorphicLayoutEffect(() => {
const { subscription } = contextValue
Expand Down