Conversation
Greptile OverviewGreptile SummaryThis PR fixes the broken optimistic create functionality for boards by centralizing the logic in Key changes:
The fix ensures that when creating a new record in a board column, the record appears immediately in the correct column through optimistic updates, matching the table view behavior. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant RecordBoardColumnHeader
participant useCreateNewIndexRecord
participant useCreateOneRecord
participant Apollo Cache
participant Backend API
participant Recoil State
User->>RecordBoardColumnHeader: Click "+" button
RecordBoardColumnHeader->>useCreateNewIndexRecord: createNewIndexRecord({position: 'first', [selectField]: columnValue})
useCreateNewIndexRecord->>useCreateOneRecord: createOneRecord(recordInput)
useCreateOneRecord->>Apollo Cache: Create optimistic record
useCreateOneRecord->>Backend API: Mutation: createRecord
useCreateOneRecord-->>useCreateNewIndexRecord: Return created record
alt recordIndexGroupFieldMetadataItem exists
useCreateNewIndexRecord->>useCreateNewIndexRecord: Find matching recordGroup by field value
alt recordGroup found
useCreateNewIndexRecord->>Recoil State: Get current recordIds for group
alt position === 'first'
useCreateNewIndexRecord->>Recoil State: Set [newRecordId, ...currentIds]
else position !== 'first'
useCreateNewIndexRecord->>Recoil State: Set [...currentIds, newRecordId]
end
end
end
useCreateNewIndexRecord->>Recoil State: upsertRecordsInStore([createdRecord])
alt Open in side panel
useCreateNewIndexRecord->>useCreateNewIndexRecord: openRecordInCommandMenu()
useCreateNewIndexRecord->>useCreateNewIndexRecord: openRecordTitleCell()
else Navigate to record page
useCreateNewIndexRecord->>User: Navigate to RecordShowPage
end
Backend API-->>Apollo Cache: Return actual record data
Apollo Cache->>Recoil State: Update with server response
RecordBoardColumnHeader->>User: Show new record in column
|
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:57509 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
Hey @lucasbordeau! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
This PR fixes create new optimistic on boards, which was broken due to a recent refactor of the query system for boards in : twentyhq#16063
This PR fixes create new optimistic on boards, which was broken due to a recent refactor of the query system for boards in : #16063