Skip to content

perf: FIT-1300: Memoize sorted entities and capabilities in AnnotationsCarousel#9266

Open
bmartel wants to merge 1 commit intodevelopfrom
fb-fit-1300
Open

perf: FIT-1300: Memoize sorted entities and capabilities in AnnotationsCarousel#9266
bmartel wants to merge 1 commit intodevelopfrom
fb-fit-1300

Conversation

@bmartel
Copy link
Contributor

@bmartel bmartel commented Jan 26, 2026

Problem

sortAnnotations() is called on every render, re-sorting the array unnecessarily. The capabilities object is also recreated on every render, causing child components to receive new props.

Solution

Add useMemo for:

  • sortedEntities to avoid re-sorting on every render
  • capabilities object to maintain referential equality

Files Changed

  • web/libs/editor/src/components/AnnotationsCarousel/AnnotationsCarousel.tsx

Add useMemo for:
- sortedEntities: avoid re-sorting array on every render
- capabilities: avoid creating new object on every render

This reduces unnecessary work during re-renders when parent components
update. The OutlinerTree already has virtualization for regions list,
which is the main bottleneck for large datasets.
@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 7bfacb2
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/6977b02747593200084a3f80

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 7bfacb2
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/6977b0285a5f820008bf5e72
😎 Deploy Preview https://deploy-preview-9266--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 7bfacb2
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/6977b028ba6280000863c0ac
😎 Deploy Preview https://deploy-preview-9266--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 7bfacb2
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/6977b02854e5b5000853ba8d

@robot-ci-heartex
Copy link
Collaborator

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

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