From c60f73befd90537eaf37b14d5f34e2aae3f1dda0 Mon Sep 17 00:00:00 2001 From: Benjamin Fan Date: Wed, 21 May 2025 14:48:54 -0700 Subject: [PATCH] fix(react): Add URL formats to Bookmarked Set picker --- packages/react/components/Editor/components/Set.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react/components/Editor/components/Set.mjs b/packages/react/components/Editor/components/Set.mjs index e8c38e5fc83..8ab87cc0fc6 100644 --- a/packages/react/components/Editor/components/Set.mjs +++ b/packages/react/components/Editor/components/Set.mjs @@ -130,10 +130,15 @@ export const BookmarkedSetPicker = ({ const [status, body] = await backend.getBookmarks() const loadedSets = {} if (status === 200 && body.result === 'success') { + const setsRE = /\/set(\?id=|s\/)(\d+)$/ + const unique_ids = new Set() for (const bookmark of body.bookmarks.filter((bookmark) => bookmark.type === 'set')) { - let set + const match = bookmark.url.match(setsRE) + if (match) unique_ids.add(match[2]) + } + for (const id of unique_ids) { try { - const [status, body] = await backend.getSet(bookmark.url.slice(6)) + const [status, body] = await backend.getSet(id) if (status === 200 && body.result === 'success') { const [hasMeasies] = hasRequiredMeasurements(Design, body.set.measies) loadedSets[body.set.id] = { ...body.set, hasMeasies }