From 9361f9c25aae3ce2107f8d3d585517b767c3d3d1 Mon Sep 17 00:00:00 2001 From: martinerko Date: Thu, 2 Oct 2025 19:53:56 +1000 Subject: [PATCH] fix(index): preserve existing fields configuration (#13639) (#13640) Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com> Co-authored-by: Adrien de Peretti --- .changeset/mean-rockets-worry.md | 5 +++++ packages/modules/index/src/utils/build-config.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/mean-rockets-worry.md diff --git a/.changeset/mean-rockets-worry.md b/.changeset/mean-rockets-worry.md new file mode 100644 index 0000000000..0cc715faa6 --- /dev/null +++ b/.changeset/mean-rockets-worry.md @@ -0,0 +1,5 @@ +--- +"@medusajs/index": patch +--- + +fix(index): preserve existing fields configuration (#13639) diff --git a/packages/modules/index/src/utils/build-config.ts b/packages/modules/index/src/utils/build-config.ts index 515bc155cc..c7e1b599e1 100644 --- a/packages/modules/index/src/utils/build-config.ts +++ b/packages/modules/index/src/utils/build-config.ts @@ -845,7 +845,9 @@ function processEntity( ] intermediateEntityObjectRepresentationRef.moduleConfig = intermediateEntityModule - intermediateEntityObjectRepresentationRef.fields = ["id"] + if (!intermediateEntityObjectRepresentationRef.fields.includes("id")) { + intermediateEntityObjectRepresentationRef.fields.push("id") + } /** * We push the parent id only between intermediate entities but not between intermediate and link