prismicio / prismic-gatsby

Gatsby plugins for building websites using Prismic
https://prismic.io/docs/technologies/gatsby
Apache License 2.0
313 stars 96 forks source link

refactor(previews): improve performance for large repositories #506

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Package

Types of changes

Description

This PR improves performance during previews orchistrated by gatsby-plugin-prismic-previews. The performance improvement is negligible for relatively small repositories, but should be noticable to large repositories (>500 documents).

Note that this does not fundamentally change the way previews work; it will still fetch all documents in the repository to ensure near identical behavior to the Gatsby's native GraphQL API.

The changes in this PR remove extra computation that is not critical during client-side previews.

For more details, see #500.

(Thank you to @Baztoune for diagnosing the issue and finding a fix. Also, thank you to everyone who has reported the issue in #500 and shared their experience.)

Checklist: