-
Notifications
You must be signed in to change notification settings - Fork 467
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
chore(edit-content): Issues with n-1 relationship #31103
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.
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
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.
Copilot reviewed 5 out of 10 changed files in this pull request and generated no comments.
Files not reviewed (5)
- core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/components/dot-select-existing-content/dot-select-existing-content.component.html: Language not supported
- core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/dot-edit-content-relationship-field.component.html: Language not supported
- core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/components/dot-select-existing-content/dot-select-existing-content.component.ts: Evaluated as low risk
- core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.spec.ts: Evaluated as low risk
- core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.ts: Evaluated as low risk
Comments suppressed due to low confidence (1)
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.ts:16
- The error message should be more descriptive. Consider changing it to:
Invalid relationship type for cardinality value: ${cardinality}. Expected values are 0, 1, 2, or 3.
throw new Error(`Invalid relationship type for cardinality: ${cardinality}`);
Proposed Changes
This pull request includes several changes to the
dot-edit-content-relationship-field
component and its associated utilities. The most important changes include removing an unimplemented command, adding detailed documentation for relationship options, updating test cases to cover additional scenarios, and modifying the logic for determining selection mode based on relationship type.Codebase simplification:
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/dot-edit-content-relationship-field.component.ts
: Removed the unimplemented command for creating new content.Documentation improvements:
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/dot-edit-content-relationship-field.constants.ts
: Added detailed documentation for theRELATIONSHIP_OPTIONS
constant, explaining the mapping of cardinality numbers toRelationshipTypes
enum values.Test coverage enhancements:
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.spec.ts
: Added a test case for theMANY_TO_ONE
relationship type to ensure it returns "single" selection mode.core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.spec.ts
: Improved the error message for invalid cardinality values in the test case.Logic updates:
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/utils/index.ts
: Updated thegetSelectionModeByCardinality
function to include theMANY_TO_ONE
relationship type in the single mode condition.Checklist
This PR fixes: #31040