Add Check on network existence before fetching countries. - #4056
Add Check on network existence before fetching countries.#4056basseche wants to merge 6 commits into
Conversation
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe hook now loads country filters and substation properties through separate async helpers. It adds error handling for both flows. It also keeps the network existence check before the country fetch. ChangesGlobal filter loading flow
Sequence Diagram(s)sequenceDiagram
participant useGlobalFilterOptions
participant fetchNetworkExistence
participant fetchAllCountries
participant snackWithFallback
useGlobalFilterOptions->>fetchNetworkExistence: fetch network existence
fetchNetworkExistence-->>useGlobalFilterOptions: response
alt response.status is HttpStatusCode.OK
useGlobalFilterOptions->>fetchAllCountries: fetch countries
fetchAllCountries-->>useGlobalFilterOptions: country filters
else request fails
useGlobalFilterOptions->>snackWithFallback: FetchCountryError
end
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change adds a guard before fetching countries and handles related fetch failures without introducing a broader product or production risk. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/results/common/global-filter/use-global-filter-options.ts`:
- Around line 57-73: The fetchNetworkExistence promise chain is missing a
rejection handler, which can result in unhandled promise rejections if that call
fails. Add a .catch() handler to the fetchNetworkExistence(studyUuid,
currentRootNetworkUuid) promise chain to handle any errors that occur during the
network existence check, similar to how the fetchAllCountries call already has
error handling with snackWithFallback. This ensures all network requests in this
flow have proper error handling coverage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 23abd83c-4522-45ea-9dc1-933ed71c036f
📒 Files selected for processing (1)
src/components/results/common/global-filter/use-global-filter-options.ts
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
|
…foreCountriesFetch # Conflicts: # src/components/results/common/global-filter/hooks/use-global-filter-options.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/components/results/common/global-filter/hooks/use-global-filter-options.ts`:
- Line 58: Update the global-filter options flow so
fetchSubstationPropertiesGlobalFilters() runs independently using only the study
metadata. Keep the early return and network existence/country fetch gated by
studyUuid, currentNode?.id, and currentRootNetworkUuid, but invoke the
substation-property fetch before that context gate.
- Around line 57-77: Invoke the locally defined run function inside the
useEffect callback before the effect returns, ensuring the existing
network-existence check and country-fetch flow execute when its dependencies
change.
- Line 60: Update the request flow around fetchNetworkExistence in the run
callback to handle rejected transport promises before accessing response.status.
Attach the existing run rejection handler to cover this await, or catch the
fetchNetworkExistence failure locally and preserve the established error-state
behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a3a47614-af0f-451b-bf34-7557e9e92e09
📒 Files selected for processing (1)
src/components/results/common/global-filter/hooks/use-global-filter-options.ts
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
|



PR Summary
Add a check to avoid snackbar error on countries fetch when root networks is invalidated.