You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently state for spaces contained in a parent space is kept at the parent space however keeping this in sync with standard React state methods is proving to be difficult. Addition and removal of spaces as well as changing their properties has to propagate a state change to Fill spaces in the same parent/layer.
The current implementation relies on a side effect in the render method of a space to fulfill the implementation for the <Fill /> space and stacked spaces. This has manifested itself as a React warning "Cannot update a component from inside the function body of a different component" in the latest versions of React.
As use of space components technically drive the state, moving the state to a global state container will potentially alleviate these issues by retaining complete control over the re-rendering of space components that have changed.
A existing global state container (i.e. MOBX, Redux) is potentially overkill and will add unnecessary overhead so and a very specific custom global state container is preferable. Potentially this global state container may be able to be used as a backend for different frameworks.
+1 for this one :). Just ran into it and spent about 30 minutes trying to fix my code :D, especially as I couldn't see the warning on your example website. But after a simple code from your website also failed I finally checked "Issues" :D.
I also agree Redux would be overkill. Not an expert in React, but maybe this is a situation when React's context is good enough? Or if not, Flux?
Uh oh!
There was an error while loading. Please reload this page.
Currently state for spaces contained in a parent space is kept at the parent space however keeping this in sync with standard React state methods is proving to be difficult. Addition and removal of spaces as well as changing their properties has to propagate a state change to Fill spaces in the same parent/layer.
The current implementation relies on a side effect in the render method of a space to fulfill the implementation for the
<Fill />
space and stacked spaces. This has manifested itself as a React warning "Cannot update a component from inside the function body of a different component" in the latest versions of React.As use of space components technically drive the state, moving the state to a global state container will potentially alleviate these issues by retaining complete control over the re-rendering of space components that have changed.
A existing global state container (i.e. MOBX, Redux) is potentially overkill and will add unnecessary overhead so and a very specific custom global state container is preferable. Potentially this global state container may be able to be used as a backend for different frameworks.
Initial basic implementation on global-state branch in Experimental.tsx fixes #64.
The text was updated successfully, but these errors were encountered: