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

Can some actions run before @@INIT? #73

Open
chmac opened this issue Apr 7, 2023 · 4 comments
Open

Can some actions run before @@INIT? #73

chmac opened this issue Apr 7, 2023 · 4 comments

Comments

@chmac
Copy link

chmac commented Apr 7, 2023

Firstly, thanks a lot for this package and the flipper plugin. It's a godsend to be able to see a history of redux actions again since React Native Debugger no longer works with the hermes engeine.

Edit: Please disregard the rest of this message, I think I found the issue just after posting this!

I think I've noticed something weird. I've been working on the startup process in our app. Scheduling stuff to run only after the app has booted, and so on. It seems to me as if some actions are missing from the flipper log. One guess I have is that these actions are dispatched on the store before expo renders the react part of our app. So at the time of these actions executing, maybe react hasn't started.

I know the actions were dispatched, because if I dispatch a random action, the state has changed from the @@INIT action.

Sorry, I realise this is probably pretty hard to follow. I figured I'd ask the question first, and if you have any insights, go from there. Otherwise I could try to produce a minimal reproduction to show what I mean. But I wanted to check first in case this is somehow a known behaviour, etc.

@chmac
Copy link
Author

chmac commented Apr 7, 2023

Ah, wait, maybe my actions are being dispatched before the @@INIT action, could that be it?

@chmac chmac changed the title Does the middleware rely on react somehow? Can some actions run before @@INIT? Apr 7, 2023
@chmac
Copy link
Author

chmac commented Apr 7, 2023

Right, so by the time the @@INIT action gets dispatched, my state has already changed, a few actions have dispatched, a few thunks, and my state has mutated quite far from the empty initial state.

Is there any way to invoke that action earlier? Or have I maybe misconfigured something? I put the redux-flipper middleware to the end of the middleware queue, but I guess that's the correct setup... 🤔

@chmac
Copy link
Author

chmac commented Apr 7, 2023

I was able to work around this temporarily by wrapping my startup action in a setTimeout(). A delay of 1ms wasn't enough, but 5ms and I can reliably see all my own actions.

@plwai
Copy link
Collaborator

plwai commented Apr 10, 2023

I will look into this. this should not happen.

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

2 participants