-
Notifications
You must be signed in to change notification settings - Fork 20
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
Shared config updates #452
Conversation
If a source has no shared config of its own and shares a namespace with another source that does have a shared config, then the namespace shared config is used.
🦋 Changeset detectedLatest commit: 5ddf549 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
namespace | ||
} | ||
}; | ||
config.setData({ applyNamespaceSharedConfig }); |
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.
the config object is persisted across plugin lifecycle events. So this source is writing to the global config in the hope another source that does have a shared config will apply it.
This is picked up in the afterUpdate
event
.map(key => applyNamespaceSharedConfig?.[key] || []); | ||
|
||
for (const namespaceSharedConfig of namespaceSharedConfigs) { | ||
if (await mutableFilesystem.promises.exists(namespaceSharedConfig.rootPath)) { |
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.
This is to guard against the actual write of the shared config.json that is a copy. It might trigger afterUpdate again but not 100% sure
Pull Request Test Coverage Report for Build 5890938994
💛 - Coveralls |
It is possible to have a source that is considered a "child" of another source. Consider:
To a Mosaic site, the product of Source B should work the same as all the other products from Source A. This includes using the shared config of Source A in pages that come from Source B.
This change adds the above feature by allowing a source to apply it's shared config to another source if they share the same namespace
Timeline