-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 show page navigation bugs #9199
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
This PR enhances the show page navigation system by improving key prop stability in action menu buttons and refining pagination logic for better edge case handling.
- Added unique
entry.key
prop for Button/IconButton components in/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenuButtons.tsx
replacing array indices - Improved pagination logic in
/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
with explicit first/last record checks and cache availability validation - Fixed total count calculation by including current record in
/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
if (isFirstRecord) { | ||
if (cacheIsAvailableForNavigation) { | ||
const lastRecordIdFromCache = | ||
recordIdsInCache[recordIdsInCache.length - 1]; | ||
|
||
navigate( | ||
buildShowPageURL( | ||
objectNameSingular, | ||
lastRecordIdFromCache, | ||
viewIdQueryParam, | ||
), | ||
); | ||
} | ||
} else { |
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.
logic: potential race condition if cache becomes unavailable between check and navigation
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.
LGTM
const navigateToNextRecord = () => { | ||
if (isDefined(recordAfter)) { | ||
if (isLastRecord) { | ||
if (cacheIsAvailableForNavigation) { |
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.
redundant if?
Fixes total count bug that was -1 the total count Fixes a bug when trying to go from first to last or the other way around Fixes a React array key bug Follow-up issue (non critical) : twentyhq#9197
Fixes total count bug that was -1 the total count
Fixes a bug when trying to go from first to last or the other way around
Fixes a React array key bug
Follow-up issue (non critical) : #9197