-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed record table fetch more scroll bug (#6790)
Fetch more on the record table was causing a strange bug where it was auto scrolling to the bottom of the newly loaded chunk of rows. This was confusing because we lost our previous position in the record table. With this fix the table doesn't scroll when more rows are loaded. The fetch more row has been moved in the same tbody as the rest of the rows. We now only hide it when there is no more record to fetch. --------- Co-authored-by: Charles Bochet <[email protected]>
- Loading branch information
1 parent
cd06ae2
commit b05361e
Showing
6 changed files
with
70 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
20 changes: 15 additions & 5 deletions
20
packages/twenty-front/src/modules/object-record/record-table/components/RecordTableRows.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates'; | ||
import { RecordTableBodyFetchMoreLoader } from '@/object-record/record-table/record-table-body/components/RecordTableBodyFetchMoreLoader'; | ||
import { RecordTableRow } from '@/object-record/record-table/record-table-row/components/RecordTableRow'; | ||
|
||
export const RecordTableRows = () => { | ||
const { tableRowIdsState } = useRecordTableStates(); | ||
|
||
const tableRowIds = useRecoilValue(tableRowIdsState); | ||
|
||
return tableRowIds.map((recordId, rowIndex) => { | ||
return ( | ||
<RecordTableRow key={recordId} recordId={recordId} rowIndex={rowIndex} /> | ||
); | ||
}); | ||
return ( | ||
<> | ||
{tableRowIds.map((recordId, rowIndex) => { | ||
return ( | ||
<RecordTableRow | ||
key={recordId} | ||
recordId={recordId} | ||
rowIndex={rowIndex} | ||
/> | ||
); | ||
})} | ||
<RecordTableBodyFetchMoreLoader /> | ||
</> | ||
); | ||
}; |
This file contains 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
This file contains 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
This file contains 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
9 changes: 9 additions & 0 deletions
9
...ules/object-record/record-table/states/hasRecordTableFetchedAllRecordsComponentStateV2.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { RecordTableScopeInternalContext } from '@/object-record/record-table/scopes/scope-internal-context/RecordTableScopeInternalContext'; | ||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2'; | ||
|
||
export const hasRecordTableFetchedAllRecordsComponentStateV2 = | ||
createComponentStateV2<boolean>({ | ||
key: 'hasRecordTableFetchedAllRecordsComponentStateV2', | ||
componentContext: RecordTableScopeInternalContext, | ||
defaultValue: false, | ||
}); |