Skip to content

Conversation

jpggvilaca
Copy link
Contributor

Summary

  • Created this PR to know if we're falling into the same Provider hell as before. Not that is a really bad thing, but there's always other ways of doing things. This is mostly to get feedback. Performance wise is more or less the same thing, but readability wise is better imho

Resources:

How to test

Checklist

  • The PR title and description are clear and descriptive
  • I have manually tested the changes
  • All changes are covered by automated tests
  • All related issues are linked to this PR (if applicable)
  • Documentation has been updated (if applicable)

@jpggvilaca jpggvilaca requested a review from a team as a code owner October 17, 2025 09:20
@Copilot Copilot AI review requested due to automatic review settings October 17, 2025 09:20
@jpggvilaca jpggvilaca added the Geti Tune UI Issues related to Geti Tune Studio UI label Oct 17, 2025
};

export const zoomStore = create<ZoomStore>()(
devtools(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to use ReduxDevTools without redux.

Screenshot 2025-10-17 at 10 49 32

y: state.initialCoordinates.y,
},
}),
false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to replace the state or not

},
}),
false,
'fitToScreen'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name for redux dev tools

)
);

export const useZoom = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 hooks, 1 for values and another for "actions"

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Migrates zoom state management from a React Context provider to a global Zustand store, updating all consumers and removing the previous provider and one related test.

  • Replace ZoomProvider with a singleton Zustand store (zoom.store.ts) and refactor imports/usages.
  • Update components and tests to use new hooks; remove zoom-fit-screen test.
  • Add new zoom actions (resetZoom) and dependency on zustand.

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
application/ui/src/routes/inference/inference.tsx Removed ZoomProvider wrapper around StreamContainer.
application/ui/src/features/dataset/media-preview/primary-toolbar/zoom/zoom-selector.test.tsx Updated mocks to target new Zustand store.
application/ui/src/features/dataset/media-preview/primary-toolbar/zoom/zoom-selector.component.tsx Refactored to use new useZoom/useSetZoom from store.
application/ui/src/features/dataset/media-preview/primary-toolbar/zoom/zoom-fit-screen.test.tsx Removed test covering fit-to-screen action.
application/ui/src/features/dataset/media-preview/primary-toolbar/zoom/zoom-fit-screen.component.tsx Switched to store hook import.
application/ui/src/features/dataset/media-preview/media-preview.component.tsx Removed ZoomProvider wrapper.
application/ui/src/features/annotator/tools/segment-anything-tool/segment-anything-tool.component.tsx Switched zoom hook import.
application/ui/src/features/annotator/tools/bounding-box-tool/bounding-box-tool.component.tsx Switched zoom hook import.
application/ui/src/features/annotator/annotations/editable-annotation.component.tsx Switched zoom hook import.
application/ui/src/components/zoom/zoom.test.tsx Test no longer wraps with provider.
application/ui/src/components/zoom/zoom.store.ts Added new global Zustand zoom store and hooks.
application/ui/src/components/zoom/zoom.provider.tsx Removed legacy context provider implementation.
application/ui/src/components/zoom/zoom-transform.tsx Adjusted to use global store directly; added fresh state reads.
application/ui/src/components/zoom/use-sync-zoom.hook.tsx Updated import to new store hook.
application/ui/package.json Added zustand dependency.
Files not reviewed (1)
  • application/ui/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

github-actions bot commented Oct 17, 2025

Docker Image Sizes

Image Size
geti-tune-pr-4919 1.5G
geti-tune-sha-5dc21fd 1.5G

Copy link

github-actions bot commented Oct 17, 2025

📊 Test coverage report

Metric Coverage
Lines 39.2%
Functions 36.0%
Branches 85.8%
Statements 39.2%

Copy link
Contributor

@MarkRedeman MarkRedeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I don't really see the need for this. In Geti the issue with providers was that we were exposing state from queries and mutations from a provider.
We don't have to do this here and can instead use the useQuery hooks locally since they all use react-query's global state already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE Geti Tune UI Issues related to Geti Tune Studio UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants