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.
✅ Project coverage is 57.81%. Comparing base (609d271) to head (7bfacb2).
⚠️ Report is 8 commits behind head on develop.

❗ There is a different number of reports uploaded between BASE (609d271) and HEAD (7bfacb2). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (609d271) HEAD (7bfacb2)
pytests 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9266      +/-   ##
===========================================
- Coverage    66.82%   57.81%   -9.02%     
===========================================
  Files          830      561     -269     
  Lines        64879    40550   -24329     
  Branches     10971    11008      +37     
===========================================
- Hits         43355    23443   -19912     
+ Misses       21520    17103    -4417     
  Partials         4        4              
Flag Coverage Δ
lsf-e2e 52.27% <100.00%> (+0.28%) ⬆️
lsf-integration 48.22% <100.00%> (-0.06%) ⬇️
lsf-unit 8.85% <0.00%> (-0.02%) ⬇️
pytests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant