Fix: deduplicate modules on app export and import#16636
Merged
johnsoncherian merged 2 commits intoJun 8, 2026
Merged
Conversation
…raint violation When an app has multiple ModuleViewer components referencing the same module, the export serializes one copy per component. On import to a fresh workspace, the loop attempts to create the same module multiple times, violating the app_name_organization_id_unique constraint. Export side: deduplicate moduleAppIds by moduleId (co_relation_id) before calling this.export() for each module. Import side: deduplicate appParams.modules by co_relation_id or name before the creation loop in mapModulesForAppImport().
❌ Deploy Preview for storybook-tooljet failed.
|
a86a472
into
chore/bump-version-3.21.43-beta
452 of 455 checks passed
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.
📝 What this does
Fixes a duplicate key constraint violation when importing apps that have multiple ModuleViewer components referencing the same module. The export was serializing N copies of the module (one per ModuleViewer), and the import loop tried to create the same module N times on a fresh DB.
🔀 Changes
moduleId(co_relation_id) on the export path before callingthis.export()for each moduleappParams.modulesbyco_relation_idornameon the import path before the creation loop inmapModulesForAppImport()🧪 How to test
db:reset)QA Checklist