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

perf: keep document-drive state in shallowRef and prefetch pages/components #2118

Merged
merged 6 commits into from Jun 27, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

#2100

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR implements two changes to speed up the experience on document-driven sites. It should be considered a proof-of-concept and likely warrants further testing.

  1. First, we take advantage of the new rich JSON payloads to avoid having fully reactive page data. For deeply nested arrays of objects, this is likely to make a huge performance impact.

  2. Second, we preload content queries and the components used on those pages (if the body attribute is present).

In order to enable testing this out on a large site/codebase, I've deployed a patched version of nuxt content:

(Bear in mind that to test out the document driven changes you will need to stay within the /docs subpath as other pages do not use this strategy and will not be affected by these improvements.)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe self-assigned this Jun 24, 2023
@netlify
Copy link

netlify bot commented Jun 24, 2023

βœ… Deploy Preview for nuxt-content canceled.

Name Link
πŸ”¨ Latest commit 46c0dbe
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt-content/deploys/649ac056de23ef0008a0ec44

@danielroe danielroe changed the title perf: use shallowRef for state to avoid tracking entire contents perf: keep document-drive state in shallowRef and prefetch pages/components Jun 24, 2023
@danielroe danielroe added the enhancement New feature or request label Jun 24, 2023
@danielroe danielroe requested review from Tahul and farnabaz June 24, 2023 13:26
Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

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

Thanks

@farnabaz farnabaz merged commit b88cc2f into main Jun 27, 2023
7 checks passed
@farnabaz farnabaz deleted the perf/speed-up branch June 27, 2023 11:04
@farnabaz farnabaz mentioned this pull request Jul 18, 2023
@rikzwarthoff
Copy link

@danielroe @farnabaz @Atinux, Hi guys looks like this is causing some problems. It's also prefetching urls that are relative but external to the application. #2336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants