-
Notifications
You must be signed in to change notification settings - Fork 20
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
FEATURE/HCMPRE-007 : Draft Flow #2050
base: console
Are you sure you want to change the base?
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces modifications across multiple files in the microplan module, focusing on enhancing user interface customizations, state management, and error handling. The changes primarily target the Changes
Possibly related PRs
Suggested Reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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
CodeRabbit Configuration File (
|
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: 12
🔭 Outside diff range comments (12)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js (4)
Line range hint
21-54
: Add error handling for API responses.The component makes multiple API calls but lacks proper error handling for failed requests. This could lead to poor user experience when API calls fail.
Consider adding error boundaries or error states for API failures:
+ const [apiError, setApiError] = useState(null); const { isLoading: isPlanEmpSearchLoading, data: planEmployee, error: planEmployeeError, refetch: refetchPlanEmployee, } = Digit.Hooks.microplanv1.usePlanSearchEmployeeWithTagging({ // ... existing config ... }); + useEffect(() => { + if (planEmployeeError || errorCampaign) { + setApiError(t("API_ERROR_MESSAGE")); + } + }, [planEmployeeError, errorCampaign]); + // Add error display in JSX + {apiError && <ErrorComponent message={apiError} />}
Line range hint
111-119
: Prevent potential memory leaks in useEffect.The useEffect hook that checks processData doesn't have proper cleanup, which could lead to memory leaks or state updates on unmounted component.
Add cleanup function:
useEffect(() => { + let isSubscribed = true; if (processData && processData.some((instance) => instance.action === "FINALIZE_CATCHMENT_MAPPING")) { - setDisabledAction(true); + if (isSubscribed) { + setDisabledAction(true); + } } + return () => { + isSubscribed = false; + }; }, [processData]);
Line range hint
13-20
: Consolidate loading states for better UX.The component has multiple loading states that could be consolidated for a more consistent user experience.
Consider creating a single loading state:
+ const isPageLoading = isPlanEmpSearchLoading || + isLoading || + isLoadingPlanObject || + isLoadingCampaignObject || + isProcessLoading || + isPlanFacilityLoading; - if (isPlanEmpSearchLoading || isLoading || isLoadingPlanObject || isLoadingCampaignObject || isProcessLoading ||isPlanFacilityLoading) + if (isPageLoading) return <Loader />
Line range hint
1-13
: Add PropTypes validation.The component is missing PropTypes validation which would help catch bugs early in development.
Add PropTypes:
+ import PropTypes from 'prop-types'; import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components"; // ... rest of imports const FacilityCatchmentMapping = () => { // ... component code }; + FacilityCatchmentMapping.propTypes = { + // Add relevant prop types + }; export default FacilityCatchmentMapping;health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js (7)
Line range hint
8-24
: Consider memoizing state initialization.The component initializes multiple state variables that could benefit from memoization to prevent unnecessary re-renders.
Consider using
useMemo
for complex state initializations:- const [jurisdiction, setjurisdiction] = useState([]); - const [censusJurisdiction, setCensusJurisdiction] = useState([]); + const [jurisdiction, setjurisdiction] = useState(() => []); + const [censusJurisdiction, setCensusJurisdiction] = useState(() => []);
Line range hint
92-117
: Improve error handling in fetchStatusCount.The error handling in the fetchStatusCount function could be more robust by:
- Adding specific error types
- Providing more descriptive error messages
- Implementing retry logic for transient failures
const fetchStatusCount = async () => { if (planObject) { try { await mutation.mutateAsync( { body: { CensusSearchCriteria: { tenantId: tenantId, source: microplanId, ...(isRootApprover ? {} : { assignee: user.info.uuid }), }, } }, { onSuccess: (data) => { setTotalStatusCount(data?.StatusCount); setTotalCount(data?.TotalCount); }, onError: (error) => { - setShowToast({ key: "error", label: t(error?.response?.data?.Errors?.[0]?.code) }); + const errorCode = error?.response?.data?.Errors?.[0]?.code; + setShowToast({ + key: "error", + label: t(errorCode || 'UNKNOWN_ERROR'), + transitionTime: 5000 + }); + console.error('Status count fetch failed:', error); } } ); } catch (error) { - setShowToast({ key: "error", label: t(error?.response?.data?.Errors?.[0]?.code) }); + const errorCode = error?.response?.data?.Errors?.[0]?.code; + setShowToast({ + key: "error", + label: t(errorCode || 'UNKNOWN_ERROR'), + transitionTime: 5000 + }); + console.error('Status count fetch failed:', error); } } };
Line range hint
267-284
: Optimize useEffect dependency array.The useEffect hook has a broad dependency on
data
which could cause unnecessary re-renders.useEffect(() => { if (data) { setCensusData(data?.Census); setTotalRows(data?.TotalCount) const reorderedStatusCount = Object.fromEntries( Object.entries(data?.StatusCount || {}).sort(([keyA], [keyB]) => { if (keyA === "PENDING_FOR_VALIDATION") return -1; if (keyB === "PENDING_FOR_VALIDATION") return 1; return 0; }) ); - setActiveFilter(reorderedStatusCount); + setActiveFilter((prev) => { + if (JSON.stringify(prev) === JSON.stringify(reorderedStatusCount)) { + return prev; + } + return reorderedStatusCount; + }); } - }, [data]); + }, [data?.Census, data?.TotalCount, data?.StatusCount]);
Line range hint
438-458
: Implement proper cleanup in useEffect hooks.The useEffect hooks that set up event listeners or subscriptions should have cleanup functions.
useEffect(() => { + let isSubscribed = true; if (processData && processData.some((instance) => instance.action === "APPROVE_CENSUS_DATA")) { - setDisabledAction(true); + if (isSubscribed) { + setDisabledAction(true); + } } + return () => { + isSubscribed = false; + }; }, [processData]);
Line range hint
460-471
: Add input validation for boundary selection.The boundary selection logic should validate the input more thoroughly.
const onSearch = (selectedBoundaries, selectedHierarchy) => { - if (selectedBoundaries.length === 0) { + if (!Array.isArray(selectedBoundaries) || selectedBoundaries.length === 0) { setShowToast({ key: "warning", label: t("MICROPLAN_BOUNDARY_IS_EMPTY_WARNING"), transitionTime: 5000 }); + return; } else { + if (!selectedHierarchy) { + setShowToast({ key: "warning", label: t("MICROPLAN_HIERARCHY_IS_EMPTY_WARNING"), transitionTime: 5000 }); + return; + } setActiveLink({ code: "ASSIGNED_TO_ME", name: "ASSIGNED_TO_ME" });
Line range hint
1-1000
: Consider implementing React.memo for performance optimization.The component might benefit from memoization to prevent unnecessary re-renders.
-const PopInbox = () => { +const PopInbox = React.memo(() => { // Component implementation -}; +}, (prevProps, nextProps) => { + // Add custom comparison logic if needed + return true; +});
Line range hint
1-1000
: Add prop-types for better type checking.The component would benefit from prop-types definitions for better runtime type checking.
Add the following at the end of the file:
PopInbox.propTypes = { // Add prop types here }; PopInbox.defaultProps = { // Add default props here };health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (1)
Line range hint
1-894
: Consider refactoring for better modularityThe file has grown quite large and complex. Consider these architectural improvements:
- Extract switch cases into separate handler functions
- Create a dedicated service layer for plan/project operations
- Implement a state management pattern for UI updates
Example structure:
// handlers/roleAccessHandler.js export const handleRoleAccess = async (planObject, key) => { planObject.additionalDetails.key = key; return await updatePlan(planObject); }; // services/planService.js export class PlanService { static async updatePlan(planObject) { // Plan update logic } } // utils/stateManager.js export const updateUIState = (currentKey, currentStep) => { // UI state update logic };🧰 Tools
🪛 Biome (1.9.4)
[error] 817-833: This case is falling through to the next case.
Add a
break
orreturn
statement to the end of this case to prevent fallthrough.(lint/suspicious/noFallthroughSwitchClause)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (8)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
(12 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Pattern **/*.js
: check
📓 Learnings (2)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js (2)
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1832
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:592-594
Timestamp: 2024-11-14T12:48:23.024Z
Learning: In `PopInbox.js`, when integrating the `ConfirmationPopUp` component, error handling for API failures is managed internally within the component, so explicitly passing an `onError` prop is not necessary.
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1837
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js:559-561
Timestamp: 2024-11-15T10:15:57.370Z
Learning: In `PopInbox.js`, error handling for the `onError` callback in `WorkflowCommentPopUp` is handled within the component, so explicit error handling in the parent component is unnecessary.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js (1)
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#204
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:468-481
Timestamp: 2024-11-12T10:40:17.779Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
[error] 802-802: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 803-803: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 804-804: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 812-825: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 827-839: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 892-892: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 903-903: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 914-914: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 925-925: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 829-829: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
[error] 817-833: This case is falling through to the next case.
Add a break
or return
statement to the end of this case to prevent fallthrough.
(lint/suspicious/noFallthroughSwitchClause)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
[error] 111-111: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
🔇 Additional comments (3)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (2)
868-933
: Ensure consistent i18n usage
Every place that checks for "NA" uses t("NA") or t("ES_COMMON_NA"). Confirm that all references are consistent and unify your usage for better translation coverage.
🧰 Tools
🪛 Biome (1.9.4)
[error] 892-892: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 903-903: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 914-914: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 925-925: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
769-796
: Confirm the removal of redundant fields
The preProcess method properly cleans up empty or null fields using cleanObject(). Ensure that removing the pagination field and other properties is intentional and won't break downstream code expecting these fields.
As a follow-up, consider running this shell script to search for references to the removed pagination field:
✅ Verification successful
Based on the search results, I can generate the final response since I have enough context about the pagination usage in the codebase:
Removing pagination field is safe and intentional
The commented out line // delete data.body.PlanConfigurationSearchCriteria.pagination
is safe to remove since:
- The code already handles pagination through
limit
andoffset
fields that are set directly on the search criteria object - The UI components use a standardized pagination approach through DataTable props like
paginationServer
,paginationTotalRows
, etc. - The search configurations in multiple files show that pagination is handled through the table form's limit/offset rather than a dedicated pagination object
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Searching for references to pagination in the codebase
rg -A 3 -B 3 'pagination'
Length of output: 56826
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js (1)
70-75
: Ensure proper synchronization of new props
You’re resetting the local states (selectedRegistrationDistributionMode, selectedDistributionProcess, selectedRegistrationProcess) whenever the parent’s assumption data changes. Verify that you don’t accidentally override user inputs. Also confirm that the effect does not prematurely re-trigger if props are unchanged.
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js
Show resolved
Hide resolved
...micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js
Show resolved
Hide resolved
...th/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
Outdated
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
Outdated
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Show resolved
Hide resolved
.../micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
Outdated
Show resolved
Hide resolved
.../micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
Show resolved
Hide resolved
.../micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
Outdated
Show resolved
Hide resolved
.../micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
Outdated
Show resolved
Hide resolved
…DIGIT-Frontend into FEATURE/HCMPRE-007
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: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
(1 hunks)health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
(12 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (1)
Pattern **/*.js
: check
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
[error] 817-842: This case is falling through to the next case.
Add a break
or return
statement to the end of this case to prevent fallthrough.
(lint/suspicious/noFallthroughSwitchClause)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
[error] 802-802: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 803-803: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 804-804: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 812-825: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 827-839: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 892-892: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 903-903: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 914-914: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 925-925: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 829-829: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
🔇 Additional comments (4)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js (2)
202-202
: **Document the fallback key value **
This fallback value of "2" seems arbitrary and was flagged in a past review comment. Consider providing a clear explanation or use a named constant to enhance clarity.
817-842
:
Add a break statement to prevent unintentional fallthrough
Although this case returns in both branches (success or error), adding a break ensures the code is more maintainable and less prone to unintended fallthrough.
case "ROLE_ACCESS_CONFIGURATION": {
...
if (response) {
return { ... };
} else {
...
}
+ break;
}
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 817-842: This case is falling through to the next case.
Add a break
or return
statement to the end of this case to prevent fallthrough.
(lint/suspicious/noFallthroughSwitchClause)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (2)
802-804
: 🧹 Nitpick (assertive)
Wrap declarations in a block to prevent cross-case access
Declaring variables directly after a case label can leak them to other cases. Wrap them in a block to follow best practices.
case "ACTIONS":
+ {
const dummyFile = "c22a7676-d5d7-49b6-bcdb-83e9519f58df";
const microplanFileId = row?.campaignDetails?.additionalDetails?.microplanFileId || dummyFile;
let options = [];
+ }
break;
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 802-802: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 803-803: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 804-804: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
812-825
: 🧹 Nitpick (assertive)
Wrap handleDownload function in a block
Similarly, define handleDownload in its own block to avoid potential scoping issues in other switch cases.
case "ACTIONS":
{
...
const handleDownload = () => {
...
};
...
}
break;
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 812-825: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
Feature PR: Implement HCMPRE-007
Summary by CodeRabbit