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

feat(config): enable watch for all layer configs and load in parallel #2929

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

ineshbose
Copy link
Member

πŸ”— Linked issue

❓ 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

Another small PR inspired from my reading of the implementation for v3..

A few bits I had noticed:

After #2829, we would have enabled .config/ directory (or even config in different extensions) - but I realised that the fsStat before loading the config would not allow us for this. So it started with that, then I went ahead to parallelise the call to loadContentConfig, and then resolve collectionMap. I realised that calling resolveCollections and iterating over collections was not necessary (as the key is the collection.name), so instead we use a reducer to override any low-level layer collections (ideally we would have wanted to use defu, but that is deep-default and may have side-effects for collection schemas). In addition to that, I also ensured that the configurations would work with a watcher, so thanks for watchConfig, all of this is possible.

Let me know what you think - I had to spend some time scratching my head on updating this code, so would love feedback! πŸ™‚

πŸ“ Checklist

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

Copy link

pkg-pr-new bot commented Dec 24, 2024

npm i https://pkg.pr.new/@nuxt/content@2929

commit: b482c88

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.

1 participant