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

refactor: use lazy refs for Autocomplete plugins #9

Merged
merged 3 commits into from
Sep 13, 2022

Conversation

sarahdayan
Copy link
Collaborator

This uses lazy refs instead of standard refs to lazily instantiate plugins and ensure they only get called once.

This method is recommended over useMemo because it's not designed to retain values, and could recompute arbitrarily in the future (see facebook/react#14490 (comment)).

@netlify
Copy link

netlify bot commented Sep 12, 2022

Deploy Preview for algolia-storefront-demo-nextjs ready!

Name Link
🔨 Latest commit 9707189
🔍 Latest deploy log https://app.netlify.com/sites/algolia-storefront-demo-nextjs/deploys/631f4d12e36ead00089b394c
😎 Deploy Preview https://deploy-preview-9--algolia-storefront-demo-nextjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sarahdayan sarahdayan requested a review from dhayab September 12, 2022 15:15
Copy link
Collaborator

@dhayab dhayab left a comment

Choose a reason for hiding this comment

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

TIL. Thank you!

Base automatically changed from chore/layout-cleanup to feat/recommend September 13, 2022 08:45
@sarahdayan sarahdayan merged commit f97f9f4 into feat/recommend Sep 13, 2022
@sarahdayan sarahdayan deleted the refactor/lazy-ref-autocomplete-plugins branch September 13, 2022 08:52
sarahdayan added a commit that referenced this pull request Sep 13, 2022
This uses lazy refs instead of standard refs to lazily instantiate
plugins and ensure they only get called once.

This method is recommended over `useMemo` because it's not designed to
retain values, and could recompute arbitrarily in the future (see
facebook/react#14490 (comment)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants