Store video widget size in redux#828
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the video scale state management by moving it from local component state to Redux, enabling the video scale to be persisted and shared across the application.
- Added
videoScaleto the Redux state with a default value of 1 - Created Redux action and selector for managing video scale
- Updated VideoWidget component to use Redux state instead of local state
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| gcs/src/redux/slices/droneConnectionSlice.js | Added videoScale state, action, and selector to the Redux slice |
| gcs/src/components/dashboard/videoWidget.jsx | Replaced local scale state with Redux-based state management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
gcs/src/components/dashboard/videoWidget.jsx:86
- The
updateScalefunction manually setsvideoDimensionson lines 83-86, but this logic duplicates the dimension calculation already handled by theuseEffectat lines 48-53. Since theuseEffectdepends onscaleand will run automatically whendispatch(setVideoScale(clampedScale))updates the Redux state, the manualsetVideoDimensionscall is redundant and could cause race conditions or inconsistent state. Remove lines 78-86 and rely on theuseEffectto update dimensions.
// Recalculate dimensions based on new scale
const baseWidth = 350
const newWidth = baseWidth * clampedScale
const newHeight = Math.round(newWidth / baseAspectRatio)
setVideoDimensions({
width: newWidth,
height: newHeight,
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1Blademaster
left a comment
There was a problem hiding this comment.
Makes sense logically to me, haven't tested locally yet but approving anyways
Use the scale parameter to make video widget size persist between page switches.