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

Removed sort definitions #10368

Merged
merged 7 commits into from
Feb 21, 2025
Merged

Conversation

lucasbordeau
Copy link
Contributor

This PR focuses on complete removal of sort definitions.

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

This PR removes sort definitions across the codebase, simplifying the sorting system by eliminating the intermediate SortDefinition type and related utilities.

  • Removed SortDefinition type and its definition property from RecordSort, now relying directly on field metadata for sorting information
  • Replaced formatFieldMetadataItemsAsSortDefinitions with availableFieldMetadataItemsForSortFamilySelector for handling sortable fields
  • Removed availableSortDefinitionsComponentState and related Recoil states, simplifying state management for sorting
  • Modified mapViewSortsToSorts to work without sort definitions, potentially allowing invalid field metadata IDs to pass through
  • Removed mock sort definitions from sign-in background feature, suggesting a shift to more dynamic sorting approaches

28 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Removing this state could break components that depend on availableSortDefinitionsComponentState, particularly ViewBarSortEffect, ObjectSortDropdownButton, and record index components. Ensure all dependent components are updated to handle sorting without this state.

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)

Based on the additional changes since the last review, here's a focused summary of the key updates:

This PR continues the removal of sort definitions with additional cleanup and refinements across the codebase.

  • Missing ID generation in useUpsertCombinedViewSorts.ts could cause undefined behavior when matching/updating sorts without unique IDs
  • Removed useSortableFieldMetadataItemsInRecordIndexContext hook without clear replacement, impacting record index sorting functionality
  • Updated EditableSortChip to use fieldMetadataItem.label directly instead of recordSort.definition.label
  • Removed position-based sorting in useSetRecordIdsForColumn, which could affect record ordering in columns
  • Simplified ViewBarDetails to use currentRecordSorts directly rather than mapping view sorts

The changes maintain the goal of removing sort definitions but introduce some potential issues around ID generation and record ordering that should be addressed.

31 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +122 to +127
const filteredSearchInputFieldMetadataItems =
sortableFieldMetadataItems.filter((item) =>
item.label
.toLocaleLowerCase()
.includes(objectSortDropdownSearchInput.toLocaleLowerCase()),
);
);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider memoizing this filter operation to prevent unnecessary recalculations on each render

Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Removing this utility will break sorting in ObjectSortDropdownButton, useColumnDefinitionsFromFieldMetadata, and view management. Need replacement implementation or rollback.

Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Removing SortDefinition type will break existing sort functionality in ObjectSortDropdownButton, EditableSortChip, and other components that rely on this type. Ensure all consuming components are updated to use the new sorting mechanism.

Copy link
Contributor

Choose a reason for hiding this comment

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

logic: This hook is used by ObjectSortDropdownButton.tsx and other components for determining which fields can be sorted. Ensure all consumers have been updated to use an alternative method for accessing sortable fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider keeping this hook and deprecating it first to allow for a smoother transition.

@charlesBochet
Copy link
Member

I have tested and it works fine EXCEPT on Group By views

@charlesBochet charlesBochet merged commit 22203bf into main Feb 21, 2025
47 checks passed
@charlesBochet charlesBochet deleted the refactor/removed-sort-definitions branch February 21, 2025 15:59
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.

2 participants