-
Notifications
You must be signed in to change notification settings - Fork 73
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
Validate Unique ID for All Layouts in a Layout-Set #12487
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12487 +/- ##
==========================================
- Coverage 88.14% 88.12% -0.03%
==========================================
Files 1287 1271 -16
Lines 18364 18324 -40
Branches 2253 2266 +13
==========================================
- Hits 16187 16148 -39
- Misses 1905 1909 +4
+ Partials 272 267 -5 ☔ View full report in Codecov by Sentry. |
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.
Nice work! 🙂👍
export function idExists(id: string, formLayouts: IFormLayouts): boolean { | ||
return Object.values(formLayouts).some((layout) => { | ||
const idMatchesContainers = | ||
Object.keys(layout.containers || {}).findIndex( | ||
(key) => key.toUpperCase() === id.toUpperCase(), | ||
) > -1; | ||
const idMatchesComponents = | ||
Object.keys(layout.components || {}).findIndex( | ||
(key) => key.toUpperCase() === id.toUpperCase(), | ||
) > -1; | ||
|
||
return idMatchesContainers || idMatchesComponents; | ||
}); | ||
} |
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.
Her kan vi også bruke some
i stedet for findIndex
. Men ville det ikke vært ryddigere å beholde den gamle idExists
og referere til den her?
export function idExists(id: string, formLayouts: IFormLayouts): boolean {
return Object.values(formLayouts).some((layout) => idExistsInLayout(id, layout));
}
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.
Det var et godt forslag! Jeg skal fikse det
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.
Description
Refactored
idExists
validation to support multiple layouts. The unique ID rule now considers all layouts within a layout-set.Related Issue(s)
Verification
Documentation