Skip to content

fix: preserve Data Manager summary results across lean refetches - #9938

Open
omid511 wants to merge 1 commit into
HumanSignal:developfrom
omid511:fix/dm-summary-results-9897
Open

fix: preserve Data Manager summary results across lean refetches#9938
omid511 wants to merge 1 commit into
HumanSignal:developfrom
omid511:fix/dm-summary-results-9897

Conversation

@omid511

@omid511 omid511 commented Sep 11, 2026

Copy link
Copy Markdown

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 frontend setList replaced rendered values with that "" wholesale (web/libs/datamanager/src/mixins/DataStore/DataStore.js). A resize triggers view.save() → list reload with the settled view, which is why values come back. Full chain in #9897 (comment).

Fix

  • DataStore.setList now consults an optional per-store mergeListItem(existing, incoming) hook (stores without it keep exact previous behavior).
  • TasksStore.mergeListItem preserves cached annotations_results/predictions_results only 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 in mergeSnapshot.

Tests

  • DataStore.test.js: hook wiring — lean refetch preserves via hook; behavior unchanged without hook.
  • __tests__/tasks.test.js: 5 cases for preserveUnevaluatedSummaries (preserve on positive counter, blank on zero counter, fresh values win, no-cache passthrough, missing keys treated as unevaluated).
  • Run: 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).
  • Note: Tabs suites in this lib currently fail at import on missing react-router-dom in a bare checkout; verified identical failure without this change (pre-existing env gap, unrelated files).

Acceptance criteria (for QA)

  1. Open a project with annotated tasks, Annotation Results column visible — values render.
  2. Open any task in the labelling view, navigate back to the grid — Annotation Results still shows values, no resize needed.
  3. Delete an annotation so a task has zero annotations, return to the grid — its cell correctly blanks (no stale preservation).
  4. Edit annotation results, return — fresh values display (no stale preservation).

@omid511
omid511 requested a review from a team as a code owner September 11, 2026 09:23
@netlify

netlify Bot commented Sep 11, 2026

Copy link
Copy Markdown

👷 Deploy request for heartex-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2858b6c

@netlify

netlify Bot commented Sep 11, 2026

Copy link
Copy Markdown

👷 Deploy request for label-studio-docs-new-theme pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2858b6c

@netlify

netlify Bot commented Sep 11, 2026

Copy link
Copy Markdown

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 2858b6c
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/6aa3c8907ef7520008955f18
😎 Deploy Preview https://deploy-preview-9938--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@netlify

netlify Bot commented Sep 11, 2026

Copy link
Copy Markdown

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 2858b6c
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/6aa3c890bcf08e0008bf1bcf
😎 Deploy Preview https://deploy-preview-9938--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

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.

Data Manager Annotation Results Disappear

1 participant