Skip to content

Conversation

@camiloHimura
Copy link

📝 Description

This PR adds a custom query to retrieve predictions and refactors the inference-provider.component.tsx, renaming it to inference-opacity-provider.component.tsx and delegating opacity control to it only. This helps avoid unnecessary re-renders in the virtualized list items. #3148 (comment)

  • Provide a clear summary of the changes and the issue that has been addressed.
  • 🛠️ Fixes # (issue number)

✨ Changes

Select what type of change your PR is:

  • 🚀 New feature (non-breaking change which adds functionality)
  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🔄 Refactor (non-breaking change which refactors the code base)
  • ⚡ Performance improvements
  • 🎨 Style changes (code style/formatting)
  • 🧪 Tests (adding/modifying tests)
  • 📚 Documentation update
  • 📦 Build system changes
  • 🚧 CI/CD configuration
  • 🔧 Chore (general maintenance)
  • 🔒 Security update
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)

✅ Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • 📚 I have made the necessary updates to the documentation (if applicable).
  • 🧪 I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).
  • 🏷️ My PR title follows conventional commit format.

For more information about code review checklists, see the Code Review Checklist.

Copy link
Contributor

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

This PR refactors inference functionality to improve performance by preventing unnecessary re-renders in virtualized list items. It introduces a custom query hook for retrieving predictions, splits the inference provider into a dedicated opacity provider, and moves inference logic from a context provider to a query-based approach.

Key changes:

  • Replaced mutation-based inference with a query-based approach using useMediaItemInference hook
  • Created InferenceOpacityProvider to manage only opacity state, separated from inference data
  • Removed the original InferenceProvider that combined inference logic with opacity management

Reviewed changes

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

Show a summary per file
File Description
inspect.tsx Removed InferenceProvider wrapper from the main inspect route
utils.ts Added isNonEmptyString utility function for type-safe string validation
main-content.test.tsx Removed InferenceProvider wrapper from test setup
inference-provider.component.tsx Deleted file containing the original combined inference and opacity provider
inference-opacity-provider.component.tsx New file implementing a focused provider for opacity state management only
media-preview.component.tsx Integrated useMediaItemInference hook and passed inference result as props
inference-result.component.tsx Refactored to receive inference result as prop instead of from context
inference-opacity.component.tsx Updated to use new opacity-only provider and receive disabled state as prop
util.tsx Extracted downloadImageAsFile helper function for reuse
use-media-item-inference.test.tsx Added comprehensive test coverage for the new inference query hook
use-media-item-inference.hook.tsx Implemented query-based inference hook using React Query
dataset-list.component.tsx Added InferenceOpacityProvider wrapper around MediaPreview component

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 16 to 17
queryFn: isNonEmptyString(selectedModelId)
? async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you change the order of this ternary to be,

isNonEmtpyString(selectedModelId) === false ? skipToken : async () => {
// code
}

the reason I like this approach more is that it is easier to see when skipToken is used (now I had to scroll all the way to the top to see when it would be returned).

Copy link
Author

Choose a reason for hiding this comment

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

updated

Signed-off-by: Colorado, Camilo <[email protected]>
@camiloHimura camiloHimura force-pushed the ccolora11/ux-updates-p4 branch from f0be2eb to dd50c8f Compare November 28, 2025 11:27
Signed-off-by: Colorado, Camilo <[email protected]>
Copilot AI review requested due to automatic review settings November 28, 2025 11:30
@camiloHimura camiloHimura force-pushed the ccolora11/ux-updates-p4 branch from dd50c8f to 39e9729 Compare November 28, 2025 11:30
Copy link
Contributor

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camiloHimura camiloHimura merged commit 652e07e into open-edge-platform:feature/geti-inspect Nov 28, 2025
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants