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

@cycle/state ignores write effects until you've actually read from the source #938

Open
monojack opened this issue Apr 1, 2020 · 0 comments

Comments

@monojack
Copy link

monojack commented Apr 1, 2020

As the title says, you have to read from the state.stream before sending any write effects otherwise they will be ignored. This is a problem when you have a transition view (like a splash screen component) that doesn't read from the state source and the write effects are sent during that splash screen.

I have a splash screen during which (amongst other things like preloading some resources) I try to auth by verifying some token from the localStorage and then store the authentication result (user data) in the state (along with some other information like what is the next "route" - based on the auth result).
The initial reducer is in the wrapper main function, so that doesn't do anything either. So unless I read from state.stream in the main function, I'm stuck.

Changing the reducerMimic$ to a MemoryStream would make it work

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

No branches or pull requests

1 participant