Add fetch params warning modal#928
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a warning modal that alerts users when they attempt to fetch parameters while the aircraft is armed or flying. The implementation introduces new Redux state to manage the modal visibility and store pending fetch actions, and updates the params component to check the drone's armed/flying status before executing fetch or refresh operations.
- Added new modal component to warn users about fetching parameters during unsafe conditions
- Updated Redux slice to manage modal state and pending fetch actions
- Modified fetch and refresh logic to check armed/flying status before execution
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| gcs/src/redux/slices/paramsSlice.js | Added Redux state for fetchParamsWarningModalOpen and pendingFetchAction, along with corresponding reducers and selectors |
| gcs/src/params.jsx | Added armed/flying state checks, created checkArmedOrFlying helper function, refactored fetchParams and refreshCallback to show warning modal when armed/flying, and integrated the new warning modal component |
| gcs/src/components/params/fetchParamsWarningModal.jsx | Created new modal component that displays context-aware warning messages and provides cancel/confirm actions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function executePendingFetch() { | ||
| // This is called by the modal when user confirms | ||
| dispatch(setFetchingVars(true)) | ||
| dispatch(emitRefreshParams()) | ||
| dispatch(setHasFetchedOnce(true)) | ||
| } |
There was a problem hiding this comment.
The function name executePendingFetch is misleading because it doesn't actually execute the pending fetch action stored in Redux state. It only performs the initial fetch operation. Consider renaming it to executeInitialFetch or performFetch to better reflect its actual behavior. Alternatively, if this function should execute the pending action, it needs to be refactored to retrieve and call pendingFetchAction from Redux state.

No description provided.