From 51a26bde1ad210a40a2f7beadd6fef02cc8372f9 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 2 Mar 2026 17:12:21 +0500 Subject: [PATCH 1/2] Fix exporter Signed-off-by: Denis Bykhov --- plugins/card-resources/src/exporter.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/card-resources/src/exporter.ts b/plugins/card-resources/src/exporter.ts index bf0c607c3d0..316f3361f91 100644 --- a/plugins/card-resources/src/exporter.ts +++ b/plugins/card-resources/src/exporter.ts @@ -20,7 +20,8 @@ import card from './plugin' export async function importModule (json: string): Promise { try { - const data = JSON.parse(json) as Doc[] + const rawData = JSON.parse(json) as Doc[] + const data = Array.from(new Map(rawData.map(d => [d._id, d])).values()) const client = getClient() const m = client.getModel() const h = client.getHierarchy() @@ -61,7 +62,8 @@ function stripData (doc: T): Data { export async function exportModule (_id: Ref>): Promise { const processed = new Set>() const res = await exportType(_id, processed) - const clear = res.map(strip) + const unique = Array.from(new Map(res.map(d => [d._id, d])).values()) + const clear = unique.map(strip) const str = JSON.stringify(clear) return str } @@ -126,12 +128,14 @@ async function exportType ( withoutDesc: boolean = false ): Promise { if (processed.has(_id)) return [] + processed.add(_id) const res: Doc[] = [] const required: Array>> = [] const client = getClient() const m = client.getModel() const h = client.getHierarchy() const type = m.findObject(_id) + if (type === undefined) return res const parent = h.getClass(_id).extends if (parent !== undefined && h.isDerived(parent, card.class.Card) && parent !== card.class.Card) { @@ -140,8 +144,6 @@ async function exportType ( } } - processed.add(_id) - if (type === undefined) return res if (type.icon === view.ids.IconWithEmoji && typeof type.color === 'string') { type.icon = card.icon.Card } From 0191501f7a6f644175407b03e4e0cf023a0309d4 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 9 Mar 2026 14:34:00 +0500 Subject: [PATCH 2/2] Fix formatting Signed-off-by: Denis Bykhov --- plugins/card-resources/src/exporter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/card-resources/src/exporter.ts b/plugins/card-resources/src/exporter.ts index 316f3361f91..d0f5ae33362 100644 --- a/plugins/card-resources/src/exporter.ts +++ b/plugins/card-resources/src/exporter.ts @@ -21,7 +21,7 @@ import card from './plugin' export async function importModule (json: string): Promise { try { const rawData = JSON.parse(json) as Doc[] - const data = Array.from(new Map(rawData.map(d => [d._id, d])).values()) + const data = Array.from(new Map(rawData.map((d) => [d._id, d])).values()) const client = getClient() const m = client.getModel() const h = client.getHierarchy() @@ -62,7 +62,7 @@ function stripData (doc: T): Data { export async function exportModule (_id: Ref>): Promise { const processed = new Set>() const res = await exportType(_id, processed) - const unique = Array.from(new Map(res.map(d => [d._id, d])).values()) + const unique = Array.from(new Map(res.map((d) => [d._id, d])).values()) const clear = unique.map(strip) const str = JSON.stringify(clear) return str