Changing size dynamically doesn't work in strict mode
See original GitHub issueDescribe the bug
Dynamically changing the size has no effect in React strict mode, either programatically or via devtools.
To Reproduce
Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/048norw86p
- Open the preview window fullscreen
- Open React devtools
- Change the
sizeprop to some other value - Notice nothing happens
Expected behavior
Changing the size prop should change the size of the fixed pane.
Additional context
As the getDerivedStateFromProps function is state dependent (it state based on the previous state), in React’s strict mode it gets tripped by this sort-of zany check:
So when you change props, getDerivedStateFromProps gets called twice and the second time, this check returns false, so newState.paneXsize is not set:
I could have this explanation wrong, I’ll admit it’s pretty confusing.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Setting css properties with javascript not working on strict mode?
(I'm betting that jQuery could handle this just fine, but I'm trying to keep page size at an absolute minimum in this particular...
Read more >Dynamic imports in StrictMode · Issue #6957 · vercel/next.js
Bug report Using the React.StrictMode wrapper, and inside this wrapper using some dynamic import. Is throwing this warning: Is not a "Bug", ...
Read more >InnoDB Strict Mode - MariaDB Knowledge Base
InnoD strict mode makes InnoDB more reliable. ... Its global value can be changed dynamically with SET GLOBAL. For example: SET GLOBAL innodb_strict_mode=ON ......
Read more >Handling common JavaScript problems - MDN Web Docs
Declaring strict mode at the top of your JavaScript code causes it to be parsed with a stricter set of rules, meaning that...
Read more >Angular CLI Strict Mode
To opt into the strict mode, you need to create a new Angular CLI app, specifying the --strict flag: The command above will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

OK, my PR now works: https://github.com/tomkp/react-split-pane/pull/315 cc @wuweiweiwu
Released in 0.1.83!!