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

chore(docs): Update "Adding Search with Algolia" guide #29460

Merged
merged 2 commits into from
May 6, 2021

Conversation

alowdon
Copy link
Contributor

@alowdon alowdon commented Feb 11, 2021

Added memoization to example to avoid re-creating the Algolia search client unnecessarily, which impacts performance

Description

In the existing example, it will recreate the Algolia search client every time the user types in the search box (as the query changes, causing the Search component to be re-rendered, which creates a new instance of the search client). This change adds memoization to the example, so that the search client is not re-created on every re-render. This is important for performance, as with the existing implementation, you would notice that every keystroke would cause two requests to be sent to Algolia, and any caching is destroyed by the fact that the client is constantly re-created. Since performance is important to Gatsby, this change to the example ensures that the search performs well when following this guide.

Added memoization to example to avoid re-creating the Algolia search client unnecessarily, which impacts performance
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 11, 2021
@vladar vladar added type: documentation An issue or pull request for improving or updating Gatsby's documentation and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 12, 2021
@LekoArts LekoArts changed the title Updated "Adding Search with Algolia" guide chore(docs): Update "Adding Search with Algolia" guide May 6, 2021
Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

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

Thanks!

@LekoArts LekoArts merged commit 448061a into gatsbyjs:master May 6, 2021
moonmeister added a commit to moonmeister/gatsby that referenced this pull request May 7, 2021
* master: (45 commits)
  chore(release): Publish next pre-minor
  fix(gatsby-source-shopify): fix linting (gatsbyjs#31291)
  fix(deps): update minor and patch for gatsby-plugin-preact (gatsbyjs#31169)
  chore: add gatsby-plugin-gatsby-cloud to renovate
  chore: update renovatebot config to support more packages (gatsbyjs#31289)
  chore(deps): update dependency @types/semver to ^7.3.5 (gatsbyjs#31148)
  fix(deps): update minor and patch for gatsby-plugin-manifest (gatsbyjs#31160)
  fix(deps): update minor and patch for gatsby-remark-copy-linked-files (gatsbyjs#31163)
  fix(deps): update dependency mini-css-extract-plugin to v1.6.0 (gatsbyjs#31158)
  chore(deps): update dependency @testing-library/react to ^11.2.6 (gatsbyjs#31168)
  docs(gatsby-source-shopify): Updates Shopify README with new plugin info (gatsbyjs#31287)
  chore: run yarn deduplicate (gatsbyjs#31285)
  docs(gatsby-plugin-image): Add docs for customizing default options (gatsbyjs#30344)
  fix(gatsby-plugin-image): print error details (gatsbyjs#30417)
  chore(docs): Update "Adding Search with Algolia" guide (gatsbyjs#29460)
  chore(docs): Update MDX frontmatter for programmatic pages (gatsbyjs#29798)
  docs: Add image plugin architecture doc (gatsbyjs#31096)
  perf(gatsby): use fastq instead of better-queue + refactor (gatsbyjs#31269)
  feat(gatsby-plugin-image): Export ImageDataLike type (gatsbyjs#30590)
  fix(gatsby): update plugin api types (gatsbyjs#30819)
  ...
axe312ger pushed a commit that referenced this pull request May 20, 2021
This was referenced Mar 13, 2022
This was referenced Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants