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

The suggested .cjs resolver fix on 3.5.4 adds 10 seconds of boot on iOS. #9437

Closed
Tracked by #9716
p-gag opened this issue Feb 17, 2022 · 2 comments · Fixed by #9716
Closed
Tracked by #9716

The suggested .cjs resolver fix on 3.5.4 adds 10 seconds of boot on iOS. #9437

p-gag opened this issue Feb 17, 2022 · 2 comments · Fixed by #9716

Comments

@p-gag
Copy link

p-gag commented Feb 17, 2022

Intended outcome:
Update Apollo client 3.3.11 -> 3.5.8 on a react-native app.

Actual outcome:
After doing it (including the .cjs resolver fix) our react-native app boot went from 1 second to 10. For the record, it felt like the whole JS code was slow but around 8 seconds was into AWS Cognito Auth.signIn. The problem occurred only on the iOS device and was not present on the simulator.

I've track down the problem to the .cjs resolver change proposed here. When I rollback everything (clean-rebuild) with this, I get the ugly 10 seconds boot.

How to reproduce the issue:
I understand I don't have a clean isolated repro but this thing was hard to find, mostly because it's device specific. There are lot of slow boot problems around react-native so my hope is to help someone else and maybe it will lead to more info on the problem.

Versions

  • with .cjs resolver fix -> slow boot

  • without -> just fine

    System:
    OS: macOS 11.3.1
    Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.3.1 - /usr/local/bin/npm
    Browsers:
    Chrome: 98.0.4758.102
    Safari: 14.1
    npmPackages:
    @apollo/client: ^3.3.11 => 3.3.11

@benjamn
Copy link
Member

benjamn commented May 13, 2022

@p-gag Could you try running npm i @apollo/client@beta to get version 3.7.0-alpha.4? I believe PR #9716 should allow you to remove the previously recommended sourceExts code from metro.config.js (and possibly remove that file completely, if there's nothing else in it), which I'm guessing will solve the slow boot time, or at least uncover some other reason for the delay.

@benjamn
Copy link
Member

benjamn commented May 17, 2022

Just tested @apollo/client@3.6.4 in a React Native project without using a metro.config.js file, and it seemed to work, so I'm fairly confident this issue will be solved if you update (npm i @apollo/client@latest) and also delete the previous fix from metro.config.js. Please let us know if that doesn't fix it for you @p-gag!

@benjamn benjamn closed this as completed May 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.