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

Feat/view groups fast follow #9513

Merged
merged 11 commits into from
Jan 9, 2025
Merged

Conversation

magrinj
Copy link
Member

@magrinj magrinj commented Jan 9, 2025

Fix #9512

@magrinj magrinj marked this pull request as ready for review January 9, 2025 15:38
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 implements significant changes to record groups functionality and fixes various UI issues, focusing on entity counting, aggregation, and visual improvements.

  • Replaces entityCountInCurrentViewComponentState with new recordIndexEntityCount states to support per-group counting and aggregation
  • Adds 32px height standardization for aggregate footers and improves vertical alignment of tags/counts in record groups
  • Implements conditional rendering of aggregate calculations on hover and "None" option in group dropdown
  • Fixes text overflow handling for long view titles with responsive max-width constraints
  • Removes sticky positioning from aggregate footer and simplifies shadow effects for better visual consistency

26 file(s) reviewed, 13 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 68 to +73
useEffect(() => {
setOnEntityCountChange(
() => (entityCount: number) => setRecordCountInCurrentView(entityCount),
() => (entityCount: number, currentRecordGroupId?: string) =>
setRecordIndexEntityCount(entityCount, currentRecordGroupId),
);
}, [setRecordCountInCurrentView, setOnEntityCountChange]);
}, [setRecordIndexEntityCount, setOnEntityCountChange]);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: setOnEntityCountChange is called on every render due to missing memoization of the callback function. Consider using useCallback here.

);
}, [setRecordCountInCurrentView, setOnEntityCountChange]);
}, [setRecordIndexEntityCount, setOnEntityCountChange]);

const setViewFieldAggregateOperation = useRecoilCallback(
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: setViewFieldAggregateOperation has empty dependency array but uses snapshot and set from useRecoilCallback. These should be added to dependencies or explicitly marked as intentionally omitted.

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 hook without a clear replacement could break record loading functionality. Need to verify where this logic was moved to ensure no functionality gaps.


const setRecordIndexEntityCount = useRecoilCallback(
({ set }) =>
(count: number, recordGroupId?: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: count parameter should be validated to ensure it's non-negative

Comment on lines +34 to +37
set(recordIndexEntityCountByGroupFamilyState(recordGroupId), count);
} else {
set(recordIndexEntityCountNoGroupFamilyState, count);
}
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 wrapping state updates in try-catch to handle potential Recoil errors gracefully

@@ -93,7 +96,7 @@ export const useSetRecordTableData = ({
set(recordIndexAllRecordIdsSelector, recordIds);
}

onEntityCountChange(totalCount);
onEntityCountChange(totalCount, currentRecordGroupId);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: onEntityCountChange is called only when currentRowIds and recordIds are different, which could miss updates when only totalCount changes

/>
{isDefined(onClick) ? (
<LightIconButton
testId="dropdown-menu-header-end-icon"
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: testId 'dropdown-menu-header-end-icon' is misleading since this is for a start icon

@@ -76,13 +96,22 @@ export const DropdownMenuHeader = ({
)}
{StartIcon && (
<StyledHeader data-testid={testId} className={className}>
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: onClick prop is not passed to StyledHeader when StartIcon is present, making the header non-clickable even when onClick is defined

Comment on lines 73 to 75
setOnEntityCountChange(
() => (entityCount: number) => setRecordCountInCurrentView(entityCount),
() => (entityCount: number) => setRecordIndexEntityCount(entityCount),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: unnecessary double arrow function nesting - could be simplified to setOnEntityCountChange(setRecordIndexEntityCount)

@@ -42,8 +42,7 @@ export const SignInBackgroundMockContainerEffect = ({
setViewObjectMetadataId,
} = useInitViewBar(viewId);

const { setRecordCountInCurrentView } =
useSetRecordCountInCurrentView(viewId);
const { setRecordIndexEntityCount } = useSetRecordIndexEntityCount(viewId);

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

style: effect has multiple unrelated responsibilities - consider splitting into separate effects for metadata setup and column setup

@twentyhq twentyhq deleted a comment from greptile-apps bot Jan 9, 2025
@twentyhq twentyhq deleted a comment from greptile-apps bot Jan 9, 2025
Copy link
Contributor

@lucasbordeau lucasbordeau left a comment

Choose a reason for hiding this comment

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

LGTM

@lucasbordeau
Copy link
Contributor

Please take care of QA for this PR !

@charlesBochet charlesBochet merged commit 0a798a6 into main Jan 9, 2025
21 of 23 checks passed
@charlesBochet charlesBochet deleted the feat/view-groups-fast-follow branch January 9, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix all followups on discord from Thomas for Record groups
3 participants