Skip to content

fix(metadata): invalidate metadata store on SSE reconnect (#22504)#22562

Open
Akash5908 wants to merge 1 commit into
twentyhq:mainfrom
Akash5908:fix/issue-22504-metadata-sse-reconnect
Open

fix(metadata): invalidate metadata store on SSE reconnect (#22504)#22562
Akash5908 wants to merge 1 commit into
twentyhq:mainfrom
Akash5908:fix/issue-22504-metadata-sse-reconnect

Conversation

@Akash5908

@Akash5908 Akash5908 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Fixes

Fixes #22504

Description

This PR fixes a bug where metadata updates (like creating a new field or a page layout) were missed if an open tab was temporarily disconnected from the server (e.g., tab backgrounded or a network blip).

Because the frontend's metadata store relies on live SSE deltas for freshness, any gap in the connection meant the new metadata would never reach the client unless a full reload occurred. This often resulted in "No Data" states for newly created layouts or widgets.

Changes:

  • Updated SSEClientEffect.tsx to call invalidateMetadataStore() upon a successful SSE reconnection.
  • Re-syncing the metadata store on reconnect ensures that any events missed during the disconnected gap are retrieved durably without requiring a manual page refresh.

Testing

  1. Open a record page tab in a workspace.
  2. From an app front component or DevTools, trigger a field creation via the metadata API (createOneField / page-layout mutations).
  3. Briefly disconnect the network or restart the server so the SSE stream drops during the mutation.
  4. Re-establish the connection.
  5. The tab should automatically refetch the metadata and reflect the new field/layout without needing a manual reload, instead of getting stuck in a "No Data" state.

Review in cubic

@twenty-ci-bot-public

Copy link
Copy Markdown

👋 Thanks for contributing to Twenty!

Your PR has been set to draft while you work on it. Once you're done, mark it as Ready for review and our automated checks will run.

Looking forward to your contribution!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@twenty-ci-bot-public

Copy link
Copy Markdown

🔍 Visual Regression Review — twenty-front

✅ No visual changes to review.

Changed: 1 · Added: 0 · Removed: 0 · Unchanged: 698

Changed stories
Story Diff %
modules-settings-playground-settingsmcpsetup--default 0%

View run details · advisory mode

@FelixMalfait

Copy link
Copy Markdown
Member

Thanks! I'll let the review to someone else in our team as I don't know this part well enough, we used to have an incremental metadata version number, not sure if that's still the case. Maybe we could use this to avoid spamming the backend, I'm afraid of the impact/volume triggered by this change (how often will it try reconnect?). @charlesBochet @Weiko would know best

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.

Metadata created at runtime never reaches already-open tabs after an SSE gap

2 participants