Skip to content
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

Merged
merged 10 commits into from
Jul 19, 2024

Conversation

lucasbordeau
Copy link
Contributor

@lucasbordeau lucasbordeau commented Jul 17, 2024

Closes #6285

@charlesBochet Also added some more utils for our component state v2.

@lucasbordeau lucasbordeau marked this pull request as draft July 17, 2024 08:32
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 to RecordIdentifierChip across multiple files for consistency (RecordBoardCard.tsx, ChipFieldDisplay.tsx, RecordIndexRecordChip.tsx).
  • Replaced isFieldChipDisplay with isFieldIdentifierDisplay in FieldDisplay.tsx and getRecordChipGenerators.ts.
  • Updated URL construction logic in RecordIndexContainer.tsx to use buildShowPageURL utility function.
  • Refactored useRecordShowPagePagination for improved readability and maintainability.
  • Added RowHeight.ts to centralize ROW_HEIGHT constant, updated RecordTableBodyEffect.tsx to use it.

14 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@charlesBochet charlesBochet marked this pull request as ready for review July 17, 2024 12:00
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 use useHandleIndexIdentifierClick 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

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 of useScrollToPosition (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 include cursorsByRecordId 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

Comment on lines +17 to +20
if (!componentContext) {
throw new Error(
`Component context for key "${componentFamilyState.key}" is not defined`,
);
Copy link
Contributor

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.

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 to useScopeIdFromStateContext.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

recordConnection: data?.[objectMetadataItem.namePlural],
})
: ([] as T[]),
getRecordsFromRecordConnection<T>({
Copy link
Member

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

Copy link
Contributor Author

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.

import { ComponentFamilyState } from '@/ui/utilities/state/component-state/types/ComponentFamilyState';
import { ComponentState } from '@/ui/utilities/state/component-state/types/ComponentState';

export const useScopeIdFromStateContext = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useComponentId!

Copy link
Contributor Author

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".

@lucasbordeau
Copy link
Contributor Author

  • infer cursor from id instead of request to get it

@lucasbordeau
Copy link
Contributor Author

Remove unused states

Copy link
Member

@charlesBochet charlesBochet left a 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?

@charlesBochet charlesBochet merged commit 1b0759e into main Jul 19, 2024
8 of 12 checks passed
@charlesBochet charlesBochet deleted the fix/post-merge-revamp-navigation-bar branch July 19, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix post merge Revamp navigation bar
2 participants