Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore settings from localStorage on componentWillMount #48

Open
gkaemmer opened this issue Nov 15, 2016 · 0 comments
Open

Restore settings from localStorage on componentWillMount #48

gkaemmer opened this issue Nov 15, 2016 · 0 comments

Comments

@gkaemmer
Copy link

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 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants