-
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(social-insurance-maintenance): add warning #17205
Conversation
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options. WalkthroughThe pull request introduces several modifications primarily focused on 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
|
Datadog ReportAll test runs ✅ 11 Total Test Services: 0 Failed, 10 Passed Test ServicesThis report shows up to 10 services
|
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: 3
🧹 Outside diff range and nitpick comments (1)
libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx (1)
Line range hint
22-34
: Avoid suppressing ESLint rules by properly handling dependencies in useEffectYou are suppressing the
react-hooks/exhaustive-deps
ESLint rule. IncludefeatureFlagClient
in the dependency array of theuseEffect
to ensure all dependencies are correctly accounted for.Apply this diff to fix the issue:
useEffect(() => { const isFlagEnabled = async () => { const ffEnabled = await featureFlagClient.getValue( `isServicePortalPaymentPlan2025Enabled`, false, ) if (ffEnabled) { setDisplayPaymentPlan(ffEnabled as boolean) } } isFlagEnabled() - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) + }, [featureFlagClient])
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts
(1 hunks)libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx
(1 hunks)libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx (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/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx (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/portals/my-pages/social-insurance-maintenance/src/lib/messages.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 (1)
libs/portals/my-pages/social-insurance-maintenance/src/lib/messages.ts (1)
125-128
: LGTM
The message renaming and updates enhance clarity and consistency across the application.
libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx
Show resolved
Hide resolved
libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx
Show resolved
Hide resolved
...tals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17205 +/- ##
==========================================
- Coverage 35.76% 35.76% -0.01%
==========================================
Files 6931 6931
Lines 147974 147962 -12
Branches 42171 42165 -6
==========================================
- Hits 52930 52925 -5
+ Misses 95044 95037 -7
Flags with carried forward coverage won't be shown. Click here to find out more. see 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Affected services are: service-portal, Deployed services: service-portal. |
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/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx (3)
Line range hint
34-45
: Consider extracting conditional rendering logicThe nested ternary conditions make the code harder to read and maintain. Consider extracting these into separate components or using early returns.
Example refactor:
const renderContent = () => { if (error && !loading) { return <Problem error={error} noBorder={false} />; } if (!error && !loading && !data?.socialInsuranceIncomePlan) { return ( <Problem type="no_data" noBorder={false} title={formatMessage(coreMessages.noData)} message={formatMessage(coreMessages.noDataFoundDetail)} imgSrc="./assets/images/sofa.svg" /> ); } return <Stack space={2}>...</Stack>; };
Line range hint
61-67
: Extract print functionality to a reusable hookConsider creating a custom hook for print functionality that could be reused across components.
Example:
const usePrint = () => { const handlePrint = useCallback(() => { window.print(); }, []); return handlePrint; };
Line range hint
68-82
: Use URL construction utilities for modify linkString concatenation for URL construction can be fragile. Consider using URL utilities or route constants.
Example:
import { joinUrl } from '@island.is/utils/url'; const modifyUrl = joinUrl( document.location.origin, formatMessage(m.incomePlanModifyLink) );
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx
(1 hunks)libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/portals/my-pages/social-insurance-maintenance/src/screens/PaymentPlan/PaymentPlan.tsx
🧰 Additional context used
📓 Path-based instructions (1)
libs/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx (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/portals/my-pages/social-insurance-maintenance/src/screens/IncomePlanDetail/IncomePlanDetail.tsx (2)
18-18
: LGTM: Import changes align with new query strategy
The switch from lazy query to regular query hook simplifies the component's data fetching strategy.
25-25
: Verify data fetching optimization
The unconditional query execution simplifies the code, but let's verify that this component is only mounted when the data is needed.
✅ Verification successful
Unconditional query execution is appropriate
The component is properly scoped and only rendered when needed, as evidenced by:
- It's lazy-loaded and only used in a specific route
/framfaersla/tekjuaaetlun/nuverandi
- The route is protected by a scope check (
ApiScope.internal
) - It's marked as
navHide: true
in navigation, indicating it's only accessed through specific navigation flows - The component represents a detail view that inherently requires the data to be loaded
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check component usage to ensure it's only rendered when needed
# Look for parent components that render IncomePlanDetail
ast-grep --pattern 'import { IncomePlanDetail } from $_' -A 10
rg -l "IncomePlanDetail" | xargs rg "<IncomePlanDetail" -A 5
Length of output: 125
Script:
#!/bin/bash
# Let's try a broader search to find any references to IncomePlanDetail
rg "IncomePlanDetail" -B 2 -A 2
# Also search for route definitions that might render this component
rg -i "route.*incomePlan.*detail" -B 2 -A 2
Length of output: 5547
What
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
IncomePlanDetail
andPaymentPlan
components with improved data fetching and rendering logic, incorporating feature flag checks.Bug Fixes
PaymentPlan
component.Chores