-
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
[9382][FRONT]: Compute highlighted object view using raw name plural #9394
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 modifies the object metadata lookup strategy to use direct plural names instead of slugified versions, fixing navigation highlighting issues for multi-word object names.
- Added
findActiveObjectMetadataItemByNamePlural
in/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts
for direct name matching - Replaced slug-based lookups with
findActiveObjectMetadataItemByNamePlural
in/packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts
- Maintains backward compatibility by keeping slug methods temporarily, with plans for future cleanup
- Fixes active view highlighting when object names contain spaces (e.g., "Guillim's Board")
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts
Outdated
Show resolved
Hide resolved
NoteI'm not sure on the way to handle this, maybe the issue isn't the slugification itself but more the fact that we use a
For instance: const findActiveObjectMetadataItemBySlug = (slug: string) =>{
console.log(slug, activeObjectMetadataItems.map(({namePlural}) => namePlural));
return activeObjectMetadataItems.find(
(activeObjectMetadataItem) =>
getObjectSlug(activeObjectMetadataItem) === toKebabCase(slug),
);} In the other hand we might wanna just get rid of the whole slug mechanics for EDIT:=> We decided with @charlesBochet to get rid of sluggication completely regarding |
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)
No significant changes found since the last review. The core changes were already covered in the previous review, which accurately described the switch from slugified to direct plural name matching for object metadata lookups.
The remaining changes appear to be minor code formatting adjustments that don't impact functionality.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Introduction
Please find related ticket here #9382
To fix the issue the solution seems to be to stop searching for last viewed
objectMetadata
using their slugged versionnamePlural
Upcoming cleanup
After discussing with @charlesBochet it seems like a bad practice to slug the
objectMetadata
, in this way in a following PR we will suggest a cleanup of the remaining method that does within theuseFilteredObjectMetadataItems.ts
Conclusion
As always any suggestions are welcomed !
Please let me know
closes #9382