Skip to content

Fix record index sync when view fields arrive via SSE#19069

Open
channi23 wants to merge 3 commits intotwentyhq:mainfrom
channi23:fix-demo-workspace-sse-view-fields
Open

Fix record index sync when view fields arrive via SSE#19069
channi23 wants to merge 3 commits intotwentyhq:mainfrom
channi23:fix-demo-workspace-sse-view-fields

Conversation

@channi23
Copy link
Copy Markdown
Contributor

Fixes #19023

What changed

This updates the record index/view field state flow so the current view can react to late-arriving viewFields coming from SSE without requiring a page refresh.

Changes:

  • extracted a narrower syncRecordIndexViewFields path in useLoadRecordIndexStates
  • kept the initial full record-index load for first entry into a view
  • added a follow-up sync in RecordIndexLoadBaseOnContextStoreEffect when the same view receives updated viewFields
  • updated ViewBarRecordFieldEffect so it re-syncs current record fields when currentView.viewFields changes instead of only initializing once

Why

There is a race when a user navigates to a custom object while AI is still creating metadata. In that case, the record index can initialize from a partial view, and later SSE viewFields updates were not being applied to the active view state. That could leave the table visually empty or incomplete until a refresh.

Impact

This should allow:

  • record index columns to update live when view fields arrive via SSE
  • view bar field state to update live as well
  • the current view to stay usable without a refresh while AI-created metadata is still streaming in

Validation

Validated locally with:

  • npx prettier --check on modified files
  • npx oxlint --type-aware on modified files

Manual verification:

  • confirmed live record creation appeared without refresh
  • manual AI/SSE testing was partially limited by Groq TPM/token caps on the selected model, but the state-sync path was verified in code and local behavior checks
image

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx">

<violation number="1" location="packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx:56">
P2: Effect now re-syncs currentRecordFields from currentView.viewFields on every local change, which can revert local/optimistic updates before viewFields are persisted or updated, effectively making currentRecordFields read-only to currentView.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@channi23 channi23 force-pushed the fix-demo-workspace-sse-view-fields branch from 6ddea69 to c620bcc Compare March 28, 2026 18:36
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.

Improve demo workspace skill

1 participant