-
Notifications
You must be signed in to change notification settings - Fork 2
Accept components only with tags (without default) #160
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
Conversation
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.
Pull Request Overview
This PR enables support for component registrations that define only tagged variants without a default component. This allows more flexible component organization where a content type may only need tag-specific components.
Key changes:
- Made the
defaultproperty optional inComponentWithVariantstype - Updated type guard and helper functions to support optional default components
- Reorganized component lookup logic to handle missing base entries when tags are specified
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/optimizely-cms-sdk/src/render/componentRegistry.ts | Made default component optional in variant definitions and updated lookup logic to support tag-only component registrations |
| test/test-website/src/components/with-display-templates.tsx | Added test components ct6/ct7 and Component6/Component7 to demonstrate tag-only component registration |
| test/test-website/src/app/en/layout.tsx | Registered test components with tag-only configurations for ct6 and ct7 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
__test__/test-website/src/components/with-display-templates.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…content-js-sdk into bugfix/CMS-46517-loose-tuples
This PR allows developers to define a component to a
ContentType:tagcombination without requiring to have the mappingContentType(without tag)