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

Add missing assumeImmutableResults documentation #9680

Merged

Conversation

henryqdineen
Copy link
Contributor

A colleague has been profiling one of our apps and has found that setting assumeImmutableResults: true has a positive impact to performance. We noticed that this option is not in the documentation so I opened this PR. Is this intentionally undocumented?

I also wonder, if using InMemoryCache is there any reason to not set assumeImmutableResults: true? Let me know if there's something obvious that I'm missing. Thanks!

Checklist:

  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

Also remove obsolete mention of freezeResults.
Copy link
Member

@benjamn benjamn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, I totally assumed this option defaulted to true after PR #5153, but no! Thanks for catching this @henryqdineen!

@benjamn benjamn merged commit 9302aea into apollographql:main May 5, 2022
@henryqdineen
Copy link
Contributor Author

henryqdineen commented May 5, 2022

Thanks Ben! Credit to @tsbehlman who brought it to my attention.

@benjamn So am I correct that we can safely set this to true in all of our apps? Is there anything we should watch out for?

@benjamn
Copy link
Member

benjamn commented May 5, 2022

@henryqdineen Yes, as long as you're using a cache like InMemoryCache that freezes its results, or you're careful about never modifying cache result objects in your application, it should be safe to pass assumeImmutableResults: true to the ApolloClient constructor.

@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants