-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: allow integrations to refresh content layer data #11878
Conversation
🦋 Changeset detectedLatest commit: 27f3654 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
3e9fabb
to
f0babff
Compare
@ascorbic can you link to us the chapter of the RFC that talks about about this new feature? If there isn't, we should add it before merging the PR |
@ematipico I proposed it here, though haven't added the final API to the PR yet |
It should be added to the document, yes |
On it. Also need to work out why the test is failing here but not locally! |
RFC updated with a new section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice addition here @ascorbic ! Just had some suggestions for your consideration to maybe tighten up with more direct instructions, and I always prefer to front load the name of the new thing being added so that if people stop reading after a few words, they know which property to look up or search for! 😄
Co-authored-by: Sarah Rainsberger <[email protected]>
c5de0dc
to
458f2f5
Compare
Changes
Adds a new
refreshContent
helper to the'astro:server:setup'
hook context. This allows an integration to trigger a refresh of the content layer. Uses for this could be to enable a webhook endpoint during dev, or to connect to a CMS and watch for updates.It can optionally make this a selective sync by passing a
loaders
array, which means it will only sync collections that use the loader with that name. It can also pass an optional context object, which is made available to the loader. This can be used to do things such as pass an incoming webhook body.Includes some cherry-picked commits from #11902
Testing
Added an example webhook endpoint to the content layer fixture, and a test that uses this.
Docs
This will need an update to the integration API docs. It includes a changeset with usage examples.