UseGlobal - Works on Expo Go , No Rerenders When Built on EAS

Managed Workflow.
eas-cli/0.37.0 darwin-x64 node-v12.19.0
react@16.13.1
reactn@ 2.2.7

i am curious if there is anything to consider while using expo or building through EAS that would prevent reactn’s useGlobal from triggering a rerender when the source data is in-state and changes. I have a development environment on expo go / simulation that updates correctly (a chat functionality - so receiving an update with new data from the server when a new message is created,) but the same code fails to execute a rerender on my staging environment built with EAS. Ensured codebase is identical locally and on the server. I tracked it to the point where useGlobal is meant to rerender. This looks to be true for any server initiated data update that should have caused useGlobal rerender. The only difference i can identify is development uses expo go and staging is built using eas. Any help or insight on where to look is greatly appreciated.

hi there! can you try with expo run:ios [--configuration Release] or expo run:android [--variant release] and check if the issue also happens? expo run is similar to EAS build compared to Expo Go and we do similar thing within EAS build process. lean more for expo run command: Introducing: Expo Run Commands. Expo Go can get you from zero to “hello… | by Evan Bacon | Exposition

1 Like

Thanks for the quick response.

So we have several projects on expo.dev that correspond to different release channels which have their own secrets we use to initialize the app and apis. They are set during build with --profile option ie eas build --platform ios --profile staging.

On development, locally, i set them in the command line using environment variables ie FOO_ID=XXXXX BAR_API_KEY=XXXX yarn start

We built this with eas in mind and I’m not really sure how to begin testing with expo run:ios. We rely on eas.json to set release channels and distribution. I’m thinking we’d have to make some considerable changes to get expo run going, no?

Errors received attempting expo run:
using expo run:ios [–configuration Release]
The expected package.json path:…/[–configuration/package.json does not exist
then trying expo run:ios
Could not find “Podfile.lock” at …/ios/Podfile.lock** . Did you run " npx pod-install "?

thanks for your information of the build flows.

the reason i was asking for expo run is because i believed the useGlobal rerendering is a client issue. Expo Go client is quite different to EAS build client and EAS build client is similar to expo run. so we’d better to clarify if the issue happens on expo run:ios or not.

i am sorry to express unclearly. i meant you can either run expo run:ios for debug build or expo run:ios –configuration Release for release build. can you also run npx pod-install before expo run:ios? the expo run:ios will actually do prebuild (making your project temporarily from managed to bare, and you can later remove these changes from git dirty state).

if there’s some difficulty for expo run:ios, i am also happy to help if you can provide a minimal reproducible example.

I appreciate the assistance - I was unable to successfully expo run given our configuration and it was difficult to reproduce the error outside of the project. I did isolate and clarify the issue even further and a workaround was found. We use back4app / parse server, so our updates come in as parse objects. We immediately attach them to custom objects and only handle custom objects throughout the app. ie CustomObject: {parseObject: parseObject, customAttribute1: “xxx” customAttribute2: “xxx” etc…}. In development on expogo, any change, either to parseObject or the customAttributes would trigger useGlobal to rerender. In staging built with EAS, however, these updates did not trigger the rerender. Our workaround was to remove the custom object, reconstruct a new one with the updated information, and reinsert it into what we manage in global. Apologies for the delay in response.