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

fresh create-react-app doesn't update the state at all when running on the development server #419

Open
TimCabbage opened this issue Apr 19, 2023 · 1 comment
Labels

Comments

@TimCabbage
Copy link

React Easy State version: 6.3.0
Platform: browser

Describe the bug
When starting a fresh create-react-app in React18 the state is stuck in the initial state and does not update the DOM at all.
Only after you change a single file, and hotReload kicks in, will it start working properly. After page refresh (f5) it returns to the broken state and needs another file change and hot reload to start working again.

At the same time setState does change the page contents.

After building the app and serving the final files, this does not happen anymore; it works properly from the get-go.

Disabling Fast-Refresh prevents react-easy-state from working at all.


For tougher bugs

To Reproduce
fresh create-react-app install

App.js:
`import './App.css';
import { store, view } from '@risingstack/react-easy-state';

const mainStore = store({
bla: 'bla'
})

function App() {
setInterval(() => {
mainStore.bla += 'adsd';
}, 100);
return (



{mainStore.bla}


);
}

export default view(App);
`

Expected behavior
State should update, doesn't.
Starts updating again only after changing anything here and HotReload kicks in.

@TimCabbage TimCabbage added the bug label Apr 19, 2023
@TimCabbage
Copy link
Author

UPDATE:
After deep diving into node_modules I've found react strictmode interferes with the functioning of this library.
Removing the strictmode wrapper removes the issues.

If this could be considered a solution, let me know and I'll close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant