mobxjs / mobxjs/mobx-react-devtools
Restore settings from localStorage on componentWillMount
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
I'm running into a problem where the mobx DevTools miss some actions that run synchronously with the page load (its an authentication check that gets run by a react-router onEnter callback).
I dug a little deeper and found that it's caused by running the restoreLogFromLocalstorage in componentDidMount in LogControl here:
Would it break things to run it in componentWillMount, which (I think) would cause it to run before those actions? Don't know if that messes up other things.
For now, I've worked around it by running this in my own Root component's componentWillMount:
const logEnabled = window.localStorage.getItem('mobx-react-devtool__logEnabled') === 'YES';
configureDevtool({ logEnabled });
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Controls/LogControl.jsx at restoreLogFromLocalstorage and compare componentDidMount with componentWillMount. Reproduce the reported synchronous react-router onEnter authentication case and verify that restored settings are available before those actions without breaking the existing LogControl behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- devtools, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100