You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code block works just fine every time you reload the app:
function*syncAuth(){constchannel=yieldcall(rsf.auth.channel)while(true){const{ user }=yieldtake(channel)console.log('User received: ',user)}}exportdefaultfunction*rootSagas(){yieldfork(syncUserSaga)}
HOWEVER if you want to delay the start of this process you cannot fork this from any other saga after any reload. It WILL work the very first time the app is launched but all subsequent reloads break:
function*initialize(){// ... a bunch of other app initialization stuff...fork(syncAuth)// ... more etc}function*syncAuth(){console.log(1)constchannel=yieldcall(rsf.auth.channel)while(true){console.log(2)const{ user }=yieldtake(channel)console.log('User received: ',user)}}exportdefaultfunction*rootSagas(){yieldfork(initialize)}
The output of this is:
1
2
but the User received is never resolved.
The text was updated successfully, but these errors were encountered:
luskin
changed the title
Event channel stops working on react native reload
Event channel stops working after react native reload
Nov 7, 2019
The following code block works just fine every time you reload the app:
HOWEVER if you want to delay the start of this process you cannot
fork
this from any other saga after any reload. It WILL work the very first time the app is launched but all subsequent reloads break:The output of this is:
but the
User received
is never resolved.The text was updated successfully, but these errors were encountered: