Fix record index sync when view fields arrive via SSE#19069
Open
channi23 wants to merge 3 commits intotwentyhq:mainfrom
Open
Fix record index sync when view fields arrive via SSE#19069channi23 wants to merge 3 commits intotwentyhq:mainfrom
channi23 wants to merge 3 commits intotwentyhq:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Contributor
There was a problem hiding this comment.
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.
packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx
Show resolved
Hide resolved
6ddea69 to
c620bcc
Compare
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 #19023
What changed
This updates the record index/view field state flow so the current view can react to late-arriving
viewFieldscoming from SSE without requiring a page refresh.Changes:
syncRecordIndexViewFieldspath inuseLoadRecordIndexStatesRecordIndexLoadBaseOnContextStoreEffectwhen the same view receives updatedviewFieldsViewBarRecordFieldEffectso it re-syncs current record fields whencurrentView.viewFieldschanges instead of only initializing onceWhy
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
viewFieldsupdates 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:
Validation
Validated locally with:
npx prettier --checkon modified filesnpx oxlint --type-awareon modified filesManual verification: