How do you programmatically Reload the App?

Expo.Util.reload() does not reload the app if the JS bundle is unchanged…

how do you get Expo to force reload every time, regardless if there are JS bundle changes or not?

Here’s my use case: after a user logs in, i need to reload expo’s App.js in order to refresh the app’s most root component and re-register my ApolloProvider client with the user’s new auth token

1 Like

Expo.Util.reload() is mostly for debugging and IIRC doesn’t behave exactly the same way on iOS and Android. For now, this approach you’re describing probably isn’t a good path to go down.

I think it would be best to rearchitect your app so that it doesn’t need to fully reload in order to reregister ApolloProvider with a new auth token.

@ccheever this is a problem with Apollo actually… their “http://” send/receive requests accept an unresolved promise, but their websocket “wss://” requests do not, so the ApolloClient wrapping the app (required by Apollo) can only be instantiated with a null bearer token if user is not logged in or hasn’t signed up yet … in other words, http works fine, but wss does not, unless the app is reloaded… not an issue with browser apps, but tricky with RN apps… any suggestions on how to re-architect this flow would be greatly appreciated

This sounds like an issue with the Apollo client. I’d recommend poking around in the Apollo client source code to see if there’s a way to reset its state, and maybe monkey patch or fork it if you need to.