Fix merge records page accumulating duplicate morph items#17705
Open
rdelassus wants to merge 4 commits intotwentyhq:mainfrom
Open
Fix merge records page accumulating duplicate morph items#17705rdelassus wants to merge 4 commits intotwentyhq:mainfrom
rdelassus wants to merge 4 commits intotwentyhq:mainfrom
Conversation
Contributor
Greptile OverviewGreptile SummaryFixed a bug where repeatedly opening the Merge Records page accumulated duplicate morph items instead of replacing them. The hook now correctly replaces existing morph items for a given page ID, preventing duplicate record IDs and extra duplicate tabs in the UI. Added comprehensive regression tests to ensure the replacement behavior works correctly. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant MergeUI as Merge Records UI
participant Hook as useOpenMergeRecordsPageInCommandMenu
participant UpdateHook as useCommandMenuUpdateNavigationMorphItemsByPage
participant State as commandMenuNavigationMorphItemsByPageState
participant Nav as navigateCommandMenu
User->>MergeUI: Click "Merge Records"
MergeUI->>Hook: openMergeRecordsPageInCommandMenu()
Hook->>Hook: Generate new pageId (UUID)
Hook->>UpdateHook: updateCommandMenuNavigationMorphItemsByPage({pageId, objectMetadataId, objectRecordIds})
Note over UpdateHook: OLD: Appended to existing items<br/>NEW: Replaces existing items
UpdateHook->>State: Get current morph items Map
UpdateHook->>UpdateHook: Map objectRecordIds to MorphItems
UpdateHook->>State: Set new Map with pageId → newMorphItems
Hook->>Hook: Fetch records from API
Hook->>Hook: Upsert records in store
Hook->>Nav: Navigate to MergeRecords page
Nav->>User: Display Merge Records page with correct items
|
Contributor
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:64466 This environment will automatically shut down when the PR is closed or after 5 hours. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When opening Merge records repeatedly, morph items for the same command-menu page were appended instead of replaced. This could produce duplicated IDs (e.g.
[A,B,B,A]) in the merge flow and extra duplicate tabs in the UI.What
useCommandMenuUpdateNavigationMorphItemsByPageto replace page morph items instead of appending existing ones.Notes
I could not run the full workspace tests locally in this environment because of existing test/build setup issues unrelated to this change (missing
packages/twenty-front/tsconfig.spec.jsonandtemporal-polyfillresolution in dependent tasks).