-
Notifications
You must be signed in to change notification settings - Fork 61
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
fix(citizenship): indexing error on child support documents #16469
Conversation
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenPassportSubSection.ts (1)
27-27
: Approved: Good use of dynamic ID generationThe addition of the
index
parameter to generate unique IDs for each passport subsection is a good improvement. It enhances the reusability of the component and allows for better handling of multiple children's passports.For consistency, consider updating the
id
property of child fields (e.g.,nationalId
,publishDate
, etc.) to use template literals as well. This would make the code more uniform and easier to maintain.Example:
id: `${Routes.CHILDRENPASSPORT}[${index}].nationalId`,libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenOtherDocumentsSubSection.ts (2)
25-25
: Approve the dynamic ID generation for the subsectionThe use of the
index
parameter in the subsection'sid
ensures unique identification for each instance, which is crucial for proper functioning and state management. This change supports effective tree-shaking and bundling practices.For consistency, consider using a constant for the route:
const CHILD_SUPPORTING_DOCUMENTS_ROUTE = Routes.CHILDSUPPORTINGDOCUMENTS; id: `${CHILD_SUPPORTING_DOCUMENTS_ROUTE}[${index}]`,This approach would make it easier to update the route in the future if needed.
29-29
: Approve the dynamic ID generation for the multiFieldThe inclusion of the
index
parameter in the multiField'sid
ensures unique identification for each instance, which is crucial for proper functioning and state management. This change supports effective tree-shaking and bundling practices.For consistency, consider using the same constant for the route as suggested in the previous comment:
const CHILD_SUPPORTING_DOCUMENTS_ROUTE = Routes.CHILDSUPPORTINGDOCUMENTS; id: `${CHILD_SUPPORTING_DOCUMENTS_ROUTE}[${index}]`,This approach would make it easier to update the route in the future if needed and maintain consistency throughout the file.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenOtherDocumentsSubSection.ts (1 hunks)
- libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenPassportSubSection.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenOtherDocumentsSubSection.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenPassportSubSection.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
🔇 Additional comments (2)
libs/application/templates/directorate-of-immigration/citizenship/src/forms/CitizenshipForm/ChildrenSupportingDocuments/ChildrenOtherDocumentsSubSection.ts (2)
25-25
: Approve the addition of theindex
parameterThe introduction of the
index
parameter in the function signature enhances the component's reusability and allows for dynamic generation of unique IDs. This change aligns well with the coding guidelines for reusability across different NextJS apps and the use of TypeScript for defining props.
25-29
: Summary of changesThe modifications to this file improve the component's reusability and ensure proper functioning with multiple instances. The introduction of the
index
parameter and its use in generating unique IDs for the subsection and multiField align well with the coding guidelines for reusability, TypeScript usage, and effective tree-shaking.Consider implementing the suggested improvements for consistency in route naming. Overall, these changes enhance the component's flexibility and maintainability.
Datadog ReportAll test runs ✅ 101 Total Test Services: 0 Failed, 98 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (4) |
...
Attach a link to issue if relevant
What
Specify what you're trying to achieve
Why
Specify why you need to achieve this
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
ChildrenOtherDocuments
andChildrenPassport
sections to support dynamic generation of unique IDs for multiple entries.Bug Fixes