Comments (5)
Marked as duplicated because it has the same root cause: the conversion to functional component. By going back to class and using getDerivedStateFromProps
to trigger those state changes, the warning and the deoptimisation go away (could not reproduce anymore).
I assume because that static method is called before render phase and so mutating state is still a valid operation
from react-sweet-state.
Duplicated #219
We have a PR up #221 that however needs validation
from react-sweet-state.
Is it duplicated?
from react-sweet-state.
This isn't really a "change in behaviour caused by React 17 to 18", but it is a bug in React 16 where using the setState API in onUpdate will always trigger an error to be logged.
This is a problem because developers will be confused by the warnings being logged and not know that they are coming from React Sweet State.
This is still an issue with certain options after #221.
I suggest the setState
parameter be removed from the update hook API on the cases it will break / print a warning.
from react-sweet-state.
While we work on #221 , a workaround is to set
defaults.batchUpdates = true
which is what we use across some products in production
from react-sweet-state.
Related Issues (20)
- Possibly incorrect type definition for `ActionThunk` HOT 2
- Incorrect selector behaviour with promises
- Input caret will jump to end of string when using store HOT 4
- better type/name for dispatched actions HOT 1
- Persistent global scoped stores HOT 2
- "Families" containers HOT 7
- Ability to pass callback function during store creation for store initialisation and updates HOT 3
- Non global states HOT 4
- Container cleanup occurs after remounting, clearing state set by onInit HOT 1
- Hook mount/unmount time depends at number of hooks on page HOT 1
- New major HOT 2
- Move from .js to .ts HOT 1
- Uncaught TypeError: Cannot read properties of null (reading 'unsubscribe') HOT 6
- Unstable scheduling behavior
- Unexpected change in behaviour beween React 17 and 18 HOT 14
- Discussion: Should an error in onUpdate trigger the container's error boundary? HOT 3
- createActions helper HOT 2
- A store's `onUpdate` handler is not called in React `StrictMode`
- Store is not removed from the registry in StrictMode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-sweet-state.