-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix post merge revamp navigation bar #6297
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Renamed
RecordIndexRecordChip
toRecordIdentifierChip
across multiple files for consistency (RecordBoardCard.tsx
,ChipFieldDisplay.tsx
,RecordIndexRecordChip.tsx
). - Replaced
isFieldChipDisplay
withisFieldIdentifierDisplay
inFieldDisplay.tsx
andgetRecordChipGenerators.ts
. - Updated URL construction logic in
RecordIndexContainer.tsx
to usebuildShowPageURL
utility function. - Refactored
useRecordShowPagePagination
for improved readability and maintainability. - Added
RowHeight.ts
to centralizeROW_HEIGHT
constant, updatedRecordTableBodyEffect.tsx
to use it.
14 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Added
useActiveFieldMetadataItems
hook to filter active fields (packages/twenty-front/src/modules/object-metadata/hooks/useActiveFieldMetadataItems.ts
). - Refactored
RecordIndexContainer.tsx
to useuseHandleIndexIdentifierClick
for navigation (packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx
). - Introduced
useHandleIndexIdentifierClick
hook for handling index identifier clicks (packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts
). - Simplified pagination logic in
useRecordShowPagePagination.ts
by removing redundant code (packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
). - Added
useQueryVariablesFromActiveFieldsOfViewOrDefaultView
hook to derive query variables (packages/twenty-front/src/modules/views/hooks/useQueryVariablesFromActiveFieldsOfViewOrDefaultView.ts
).
7 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Deprecated
useScrollRestoration
in favor ofuseScrollToPosition
(packages/twenty-front/src/hooks/useScrollRestoration.ts
) - Added
getCursorByRecordIdFromRecordConnection
utility function for cursor and record ID mapping (packages/twenty-front/src/modules/object-record/cache/utils/getCursorByRecordIdFromRecordConnection.ts
) - Enhanced
useFetchMoreRecordsWithPagination
with cursor state management (packages/twenty-front/src/modules/object-record/hooks/useFetchMoreRecordsWithPagination.ts
) - Updated
useFindManyRecords
to includecursorsByRecordId
property (packages/twenty-front/src/modules/object-record/hooks/useFindManyRecords.ts
) - Added new state management files for handling cursors by record ID (
packages/twenty-front/src/modules/object-record/record-table/states/cursorByRecordFamilyState.ts
,packages/twenty-front/src/modules/object-record/record-table/states/tableCursorByRecordComponentStateV2.ts
)
17 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
if (!componentContext) { | ||
throw new Error( | ||
`Component context for key "${componentFamilyState.key}" is not defined`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: Error message should be more descriptive for debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Renamed
useComponentIdFromContext.ts
touseScopeIdFromStateContext.ts
and updated logic to retrieve scope ID using component state key (packages/twenty-front/src/modules/ui/utilities/state/component-state/hooks/useScopeIdFromStateContext.ts
)
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
packages/twenty-front/src/modules/object-record/cache/utils/getRecordsFromRecordConnection.ts
Outdated
Show resolved
Hide resolved
recordConnection: data?.[objectMetadataItem.namePlural], | ||
}) | ||
: ([] as T[]), | ||
getRecordsFromRecordConnection<T>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the usage, but I think we should catch it earlier is it possible to have data?.[objectMetadataItem.namePlural] undefined? shouldn't we throw/return earlier in this case instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since in React we try to avoid blocking initial renders where everything is loading and we should just allow the render flow to complete, I think it's preferable here to return [] since it will allow everything to show something and base itself on loading instead on trying to guess whether undefined means loading or error.
In this case there is already an error object that we can watch to handle errors, we shouldn't mix both.
...s/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts
Outdated
Show resolved
Hide resolved
...s/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-table/states/cursorByRecordFamilyState.ts
Outdated
Show resolved
Hide resolved
...y-front/src/modules/object-record/record-table/states/tableCursorByRecordComponentStateV2.ts
Outdated
Show resolved
Hide resolved
...t/src/modules/ui/utilities/state/component-state/hooks/useExtractedComponentFamilyStateV2.ts
Show resolved
Hide resolved
import { ComponentFamilyState } from '@/ui/utilities/state/component-state/types/ComponentFamilyState'; | ||
import { ComponentState } from '@/ui/utilities/state/component-state/types/ComponentState'; | ||
|
||
export const useScopeIdFromStateContext = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useComponentId!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not componentId it's scopeId, that's not the same, scopeId is prefixed with "-scope-id".
|
Remove unused states |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up:
- infer cursor from recordId (in url)
- introduce "navigation-store" module?
Closes #6285
@charlesBochet Also added some more utils for our component state v2.