Conversation
...rc/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx
Fixed
Show fixed
Hide fixed
...-front/src/modules/object-record/record-board/components/RecordIndexBoardFetchMoreEffect.tsx
Fixed
Show fixed
Hide fixed
...-front/src/modules/object-record/record-board/components/RecordIndexBoardFetchMoreEffect.tsx
Fixed
Show fixed
Hide fixed
...nt/src/modules/object-record/record-index/components/RecordIndexGroupsInitialQueryEffect.tsx
Fixed
Show fixed
Hide fixed
...nt/src/modules/object-record/record-index/components/RecordIndexGroupsInitialQueryEffect.tsx
Fixed
Show fixed
Hide fixed
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:29479 This environment will automatically shut down when the PR is closed or after 5 hours. |
...-front/src/modules/object-record/record-board/components/RecordIndexBoardFetchMoreEffect.tsx
Fixed
Show fixed
Hide fixed
...-front/src/modules/object-record/record-board/components/RecordIndexBoardFetchMoreEffect.tsx
Fixed
Show fixed
Hide fixed
...-front/src/modules/object-record/record-board/components/RecordIndexBoardFetchMoreEffect.tsx
Fixed
Show fixed
Hide fixed
...es/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx
Fixed
Show fixed
Hide fixed
...es/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx
Fixed
Show fixed
Hide fixed
...odules/object-record/record-board/record-board-column/components/RecordBoardColumnHeader.tsx
Fixed
Show fixed
Hide fixed
98a20ab to
df3987a
Compare
Greptile OverviewGreptile SummaryThis PR refactors the record board (Kanban view) data fetching architecture to use a unified group-by query with pagination support, replacing the previous per-column loading approach.
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant RecordBoard
participant RecordBoardQueryEffect
participant useTriggerRecordBoardInitialQuery
participant useTriggerRecordBoardFetchMore
participant useRecordIndexGroupsRecordsLazyGroupBy
participant Apollo
participant GroupByWithRecordsService
participant Database
User->>RecordBoard: Navigate to Kanban view
RecordBoard->>RecordBoardQueryEffect: Mount
RecordBoardQueryEffect->>useTriggerRecordBoardInitialQuery: queryIdentifierHasChanged
useTriggerRecordBoardInitialQuery->>useRecordIndexGroupsRecordsLazyGroupBy: executeRecordIndexGroupsRecordsLazyGroupBy()
useRecordIndexGroupsRecordsLazyGroupBy->>Apollo: Query with groupBy + filter
Apollo->>GroupByWithRecordsService: resolveWithRecords()
GroupByWithRecordsService->>Database: SELECT with PARTITION BY + ROW_NUMBER
Database-->>GroupByWithRecordsService: Grouped records
GroupByWithRecordsService-->>Apollo: CommonGroupByOutputItem[]
Apollo-->>useRecordIndexGroupsRecordsLazyGroupBy: Query result
useRecordIndexGroupsRecordsLazyGroupBy-->>useTriggerRecordBoardInitialQuery: Groups with records
useTriggerRecordBoardInitialQuery->>RecordBoard: upsertRecordsInStore + setRecordIdsForColumn
User->>RecordBoard: Scroll down
RecordBoard->>RecordBoardFetchMoreInViewTriggerComponent: inView detected
RecordBoardFetchMoreInViewTriggerComponent->>RecordBoardQueryEffect: setShouldFetchMore(true)
RecordBoardQueryEffect->>useTriggerRecordBoardFetchMore: shouldFetchMore && !isFetching
useTriggerRecordBoardFetchMore->>useRecordIndexGroupsRecordsLazyGroupBy: executeQuery(offsetForRecords: newOffset)
useRecordIndexGroupsRecordsLazyGroupBy->>Apollo: Query with offset
Apollo->>GroupByWithRecordsService: resolveWithRecords(offsetForRecords)
GroupByWithRecordsService->>Database: SELECT WHERE row_number > offset
Database-->>GroupByWithRecordsService: Next page of records
GroupByWithRecordsService-->>Apollo: Paginated results
Apollo-->>useTriggerRecordBoardFetchMore: New records
useTriggerRecordBoardFetchMore->>RecordBoard: Append to recordIdsByGroup
|
packages/twenty-front/src/modules/object-record/record-board/components/RecordBoard.tsx
Outdated
Show resolved
Hide resolved
...es/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx
Outdated
Show resolved
Hide resolved
.../twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardFetchMore.ts
Outdated
Show resolved
Hide resolved
a9b4391 to
f5b96f2
Compare
bosiraphael
left a comment
There was a problem hiding this comment.
LGTM, left a small nitpick
packages/twenty-front/src/modules/object-record/record-board/components/RecordBoard.tsx
Outdated
Show resolved
Hide resolved
|
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 : #16063
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 improves the general UX and DX of boards, by modifying the query effect to only use paged group by queries.
In this PR we implement two more things in the backend for group by queries :
Miscellaneous, various bug fixes and improvements along the way :
What remains to be done
This is still a naïve fetch more implementation that will work for a few fetch more rounds, but if you scroll and load say 200 cards per column on a board, React will re-render all 200 cards of each column each time.
We would probably need to virtualize the board with paged queries as we did for the table, this could be done after this PR but seems less urgent.
What's nice is that this new query pattern is well designed for virtualization also, drawing from our experience with table virtualization, and adapted to a multi-column request pattern, like a 2:2 matrix of records, for our boards.
So the remaining work would be to design a UI solution for virtualizing this matrix of records, which could be quite different from our table virtualization mechanism.