-
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
chore(native-app): Remove old feature flags from app #16406
Conversation
WalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
Suggested labels
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
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16406 +/- ##
==========================================
- Coverage 36.75% 36.75% -0.01%
==========================================
Files 6835 6808 -27
Lines 141332 140916 -416
Branches 40240 40136 -104
==========================================
- Hits 51949 51796 -153
+ Misses 89383 89120 -263
Flags with carried forward coverage won't be shown. Click here to find out more. see 212 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportBranch report: ✅ 0 Failed, 4 Passed, 0 Skipped, 2.77s Total Time |
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 (4)
apps/native/app/src/screens/wallet/wallet.tsx (2)
141-141
: LGTM: Simplified license filtering logic.The removal of feature flag checks in the
licenseItems
useMemo hook aligns with the PR objective of removing old feature flags. This simplification improves code readability and maintainability.Consider further simplifying the filter logic for improved readability:
const licenseItems = useMemo(() => { return (res.data?.genericLicenses ?? []).filter( ({ license }) => license.status !== 'Unknown' ); }, [res.data?.genericLicenses]);This suggestion removes the unnecessary condition
(!res.loading && !res.error) || res.data
as the??
operator already handles the case whenres.data
is undefined.
227-229
: LGTM: Simplified data array construction.The removal of conditional checks for including identity documents aligns with the PR objective of removing feature flags. This change simplifies the code and improves readability.
Consider adding a null check for improved null safety:
...(resPassport?.data?.getIdentityDocument ?? []),This change ensures that even if
resPassport.data
is null or undefined, an empty array will be spread instead of potentially undefined values.apps/native/app/src/screens/wallet-passport/wallet-passport.tsx (2)
215-215
: Approve changes with a minor suggestion for improvementThe removal of the feature flag check simplifies the code and aligns with the PR objective. The children's passport section is now rendered based solely on the presence of entries in the
childrenPassport
array, which is a cleaner approach.To further improve readability, consider using optional chaining and nullish coalescing operator:
- {childrenPassport?.length > 0 ? ( + {childrenPassport?.length ? (This change makes the condition slightly more concise while maintaining the same functionality.
Line range hint
1-438
: Suggestion for future improvementsWhile the current changes are well-implemented and achieve the PR's objectives, there are opportunities for future improvements to modernize the component:
- Consider migrating from
NavigationFunctionComponent
to more modern React Navigation patterns if applicable.- Evaluate the use of React hooks for state management and side effects throughout the component.
- Assess the potential for breaking down this large component into smaller, more focused components for better maintainability.
These suggestions are not critical for the current PR but could be considered for future refactoring efforts to keep the codebase up-to-date with the latest React and NextJS best practices.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- apps/native/app/src/screens/wallet-passport/wallet-passport.tsx (1 hunks)
- apps/native/app/src/screens/wallet/wallet.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/native/app/src/screens/wallet-passport/wallet-passport.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/native/app/src/screens/wallet/wallet.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (2)
apps/native/app/src/screens/wallet/wallet.tsx (1)
110-114
: LGTM: Simplified license type inclusion aligns with PR objectives.The unconditional inclusion of all license types (
DisabilityLicense
,PCard
,Ehic
, andHuntingLicense
) in theincludedTypes
array aligns well with the PR objective of removing old feature flags. This change simplifies the code and improves maintainability.apps/native/app/src/screens/wallet-passport/wallet-passport.tsx (1)
Line range hint
1-438
: Overall impact assessment: Positive changes aligned with best practicesThe changes made to the
WalletPassportScreen
component are well-executed and align with React and NextJS best practices:
- Simplification: Removing the feature flag reduces conditional rendering complexity, making the code more maintainable.
- Localized changes: The modifications are focused on the children's passport section, minimizing the risk of unintended side effects.
- Type safety: The component's TypeScript types and props remain unchanged, maintaining strong type checking.
- Consistency: The overall structure and functionality of the component are preserved, ensuring a consistent user experience.
These changes effectively fulfill the PR objective of removing old feature flags while maintaining the component's integrity and improving its maintainability.
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! well done
Remove all old feature flags from app.
The ones that are currently used in the app now:
Checklist:
Summary by CodeRabbit
New Features
WalletPassportScreen
to always display children passport information if available.WalletScreen
to include all license types without feature flag checks.Bug Fixes