fix: preserve Data Manager summary results across lean refetches - #9938
Open
omid511 wants to merge 1 commit into
Open
fix: preserve Data Manager summary results across lean refetches#9938omid511 wants to merge 1 commit into
omid511 wants to merge 1 commit into
Conversation
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9897.
Problem
In the Data Manager grid, the Annotation Results column renders on first load but goes blank for every row after opening a task in the labelling view and navigating back. Any column resize makes the values reappear instantly.
Root cause
The grid store is destroyed on unmount and rebuilt on return, so coming back always refetches the task list. The list serializer emits
""for summary fields the queryset did not evaluate (data_manager/serializers.py_pretty_results), and the frontendsetListreplaced rendered values with that""wholesale (web/libs/datamanager/src/mixins/DataStore/DataStore.js). A resize triggersview.save()→ list reload with the settled view, which is why values come back. Full chain in #9897 (comment).Fix
DataStore.setListnow consults an optional per-storemergeListItem(existing, incoming)hook (stores without it keep exact previous behavior).TasksStore.mergeListItempreserves cachedannotations_results/predictions_resultsonly when the incoming value is empty (""/null/undefined) and the matching live counter (total_annotations/total_predictions, which exclude cancelled/deleted rows) is positive — provably an unevaluated payload, never a genuine deletion. Zero counters, fresh values, and first loads pass through untouched. Same preservation pattern as the existing user-chip merge inmergeSnapshot.Tests
DataStore.test.js: hook wiring — lean refetch preserves via hook; behavior unchanged without hook.__tests__/tasks.test.js: 5 cases forpreserveUnevaluatedSummaries(preserve on positive counter, blank on zero counter, fresh values win, no-cache passthrough, missing keys treated as unevaluated).bun test libs/datamanager/src/mixins/DataStore/DataStore.test.js libs/datamanager/src/stores/DataStores/__tests__/tasks.test.js→ 15 pass, 0 fail. Biome check clean on touched files. Backend untouched (ruff/tavern N/A).react-router-domin a bare checkout; verified identical failure without this change (pre-existing env gap, unrelated files).Acceptance criteria (for QA)