Skip to content

Keep cached group announcements visible after tab switches#774

Merged
1 commit merged into
dataelement:mainfrom
Y1fe1Zh0u:fix/group-announcement-cache-display
Jul 23, 2026
Merged

Keep cached group announcements visible after tab switches#774
1 commit merged into
dataelement:mainfrom
Y1fe1Zh0u:fix/group-announcement-cache-display

Conversation

@Y1fe1Zh0u

Copy link
Copy Markdown
Collaborator

Summary

  • Keep a cached group announcement visible when the announcement tab remounts.
  • Add a regression contract for the cached-query mount sequence.

Root cause

GroupTextFileEditor hydrated its controlled textarea from React Query cache before a later query-key reset effect cleared the draft. When the background refetch returned structurally equal data, React Query preserved the cached data reference, so the hydration effect did not run again and the announcement stayed blank until a full page refresh.

The query-key reset now runs before cached-data hydration. This preserves unsaved-edit protection without clearing the query cache, disabling structural sharing, or adding fetches.

User impact

Switching away from the group announcement tab and returning to it no longer makes the saved announcement appear empty.

Validation

  • Regression before fix: expected cached group announcement, received an empty string.
  • Targeted regression after fix: 1/1 passed.
  • Frontend test suite: 64/64 passed.
  • TypeScript and Vite production build passed.
  • git diff --check passed.

Checklist

  • Tested locally
  • No unrelated changes included

The announcement editor can remount with React Query data already available. Resetting its draft after cached-data hydration left the controlled textarea empty, so the query reset now runs before hydration and a regression contract locks that ordering.

Constraint: No new frontend test dependency; the existing suite uses node:test source contracts
Rejected: Clear the query cache or disable structural sharing | both hide the state-ordering defect and add unnecessary fetch churn
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep query-key reset before cached-data hydration unless the draft lifecycle is redesigned
Tested: Targeted regression 1/1; frontend test suite 64/64; TypeScript and Vite production build
Not-tested: Authenticated live browser flow because no Clawith backend was running locally
Y1fe1Zh0u added a commit that referenced this pull request Jul 22, 2026
The integration branch needs this pull request alongside the other v1.11.2 candidates without changing the original PR state.

Constraint: Preserve the source PR commit and merge in numeric order.
Confidence: high
Scope-risk: moderate
Related: #774
Tested: Git merge completed without unresolved conflicts
Not-tested: Combined backend and frontend suites pending
@Y1fe1Zh0u Y1fe1Zh0u closed this pull request by merging all changes into dataelement:main in 40c1f6b Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant