From bbc40b2d2c3dab2e856cdec7255b84f4f292a66f Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 23 Aug 2022 15:33:04 +0100 Subject: [PATCH 1/5] Generic handle objectid --- packages/server/src/integrations/mongodb.ts | 6 ++---- packages/server/src/integrations/tests/mongo.spec.js | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 4f2a901259..f026f36ad4 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -92,10 +92,8 @@ module MongoDBModule { if (json[field] instanceof Object) { json[field] = self.createObjectIds(json[field]) } - if ( - (field === "_id" || field?.startsWith("$")) && - typeof json[field] === "string" - ) { + if (typeof json[field] === "string" && json[field].toLowerCase().startsWith("objectid")) + { const id = json[field].match( /(?<=objectid\(['"]).*(?=['"]\))/gi )?.[0] diff --git a/packages/server/src/integrations/tests/mongo.spec.js b/packages/server/src/integrations/tests/mongo.spec.js index 9687723528..40aa6dbb58 100644 --- a/packages/server/src/integrations/tests/mongo.spec.js +++ b/packages/server/src/integrations/tests/mongo.spec.js @@ -103,16 +103,16 @@ describe("MongoDB Integration", () => { restore() }) - it("creates ObjectIds if the _id fields contains a match on ObjectId", async () => { + it("creates ObjectIds if the field contains a match on ObjectId", async () => { const query = { json: { filter: { _id: "ObjectId('ACBD12345678ABCD12345678')", - name: "ObjectId('name')" + name: "ObjectId('BBBB12345678ABCD12345678')" }, update: { _id: "ObjectId('FFFF12345678ABCD12345678')", - name: "ObjectId('updatedName')", + name: "ObjectId('CCCC12345678ABCD12345678')", }, options: { upsert: false, @@ -126,11 +126,11 @@ describe("MongoDB Integration", () => { const args = config.integration.client.updateOne.mock.calls[0] expect(args[0]).toEqual({ _id: mongo.ObjectID.createFromHexString("ACBD12345678ABCD12345678"), - name: "ObjectId('name')", + name: mongo.ObjectID.createFromHexString("BBBB12345678ABCD12345678"), }) expect(args[1]).toEqual({ _id: mongo.ObjectID.createFromHexString("FFFF12345678ABCD12345678"), - name: "ObjectId('updatedName')", + name: mongo.ObjectID.createFromHexString("CCCC12345678ABCD12345678"), }) expect(args[2]).toEqual({ upsert: false From 1e9234da8ebd912be1d8e87c62a0c19e8a7b6d28 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 23 Aug 2022 15:33:30 +0100 Subject: [PATCH 2/5] lint --- packages/server/src/integrations/mongodb.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index f026f36ad4..9f1d41d2ec 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -92,8 +92,10 @@ module MongoDBModule { if (json[field] instanceof Object) { json[field] = self.createObjectIds(json[field]) } - if (typeof json[field] === "string" && json[field].toLowerCase().startsWith("objectid")) - { + if ( + typeof json[field] === "string" && + json[field].toLowerCase().startsWith("objectid") + ) { const id = json[field].match( /(?<=objectid\(['"]).*(?=['"]\))/gi )?.[0] From 7de3f5b68bd8b85958bccd7723e73da60d27be78 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 23 Aug 2022 15:22:15 +0000 Subject: [PATCH 3/5] v1.2.44-alpha.6 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lerna.json b/lerna.json index 5bd0ea4f60..701a020419 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 0eb4a6b432..35fe29567c 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "1.2.44-alpha.5", + "@budibase/types": "1.2.44-alpha.6", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index d22cd14a6e..16a22ccb21 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "1.2.44-alpha.5", + "@budibase/string-templates": "1.2.44-alpha.6", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 03846ca99c..3d4a7f8417 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "1.2.44-alpha.5", - "@budibase/client": "1.2.44-alpha.5", - "@budibase/frontend-core": "1.2.44-alpha.5", - "@budibase/string-templates": "1.2.44-alpha.5", + "@budibase/bbui": "1.2.44-alpha.6", + "@budibase/client": "1.2.44-alpha.6", + "@budibase/frontend-core": "1.2.44-alpha.6", + "@budibase/string-templates": "1.2.44-alpha.6", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 5be1e8655a..853c099f1e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index e326167425..3904b3e688 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "1.2.44-alpha.5", - "@budibase/frontend-core": "1.2.44-alpha.5", - "@budibase/string-templates": "1.2.44-alpha.5", + "@budibase/bbui": "1.2.44-alpha.6", + "@budibase/frontend-core": "1.2.44-alpha.6", + "@budibase/string-templates": "1.2.44-alpha.6", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 79da9910a3..864c956cd9 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "1.2.44-alpha.5", + "@budibase/bbui": "1.2.44-alpha.6", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 6666754548..4569182853 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "1.2.44-alpha.5", - "@budibase/client": "1.2.44-alpha.5", + "@budibase/backend-core": "1.2.44-alpha.6", + "@budibase/client": "1.2.44-alpha.6", "@budibase/pro": "1.2.44-alpha.5", - "@budibase/string-templates": "1.2.44-alpha.5", - "@budibase/types": "1.2.44-alpha.5", + "@budibase/string-templates": "1.2.44-alpha.6", + "@budibase/types": "1.2.44-alpha.6", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 0b7395e2b1..3cea7ff657 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 6b6c737ea1..76d04d8dff 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index ebc9dd7a37..b385798b94 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.2.44-alpha.5", + "version": "1.2.44-alpha.6", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "1.2.44-alpha.5", + "@budibase/backend-core": "1.2.44-alpha.6", "@budibase/pro": "1.2.44-alpha.5", - "@budibase/string-templates": "1.2.44-alpha.5", - "@budibase/types": "1.2.44-alpha.5", + "@budibase/string-templates": "1.2.44-alpha.6", + "@budibase/types": "1.2.44-alpha.6", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 5b7c41fec2230ff80aea905debb5f66261dcf21a Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 23 Aug 2022 15:25:52 +0000 Subject: [PATCH 4/5] Update pro version to 1.2.44-alpha.6 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 4569182853..62c39098de 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "1.2.44-alpha.6", "@budibase/client": "1.2.44-alpha.6", - "@budibase/pro": "1.2.44-alpha.5", + "@budibase/pro": "1.2.44-alpha.6", "@budibase/string-templates": "1.2.44-alpha.6", "@budibase/types": "1.2.44-alpha.6", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 2940bdb7da..8d66fa8e55 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.44-alpha.5": - version "1.2.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.5.tgz#f564ad4cc9b5e2cf080d1f5988fc6ffec44d6621" - integrity sha512-RPO4h+kB6c0ivVRGSoZAOrFQFLwv8qkkS7WNjToX1AZKD1umrMQrnEwi/sldjNW6ZAKFiktZAHDyWO/Mb7AP/g== +"@budibase/backend-core@1.2.44-alpha.6": + version "1.2.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.6.tgz#902a8a0857be675f1a8aaa10538794038b168cd0" + integrity sha512-vZ34uO/IoIbx+dgHTT9TVoVhGjldVyJyUl8RxlfLiDee5fzpghVuotlSu6FpeOkW5ZpPOpENRriN0fvwxUkI7g== dependencies: - "@budibase/types" "1.2.44-alpha.5" + "@budibase/types" "1.2.44-alpha.6" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1178,13 +1178,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.2.44-alpha.5": - version "1.2.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.5.tgz#7ae5e593eccddb749da17df0354929eaaadc4e60" - integrity sha512-lfHDUsD0dRHg/NE71i1zCzVal89ceWilnTHdJ0om3TdZ7qkqtsRUIE8/pz+NoqNAjZ13qG0p75Ue+NEjI24lAQ== +"@budibase/pro@1.2.44-alpha.6": + version "1.2.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.6.tgz#40e4f61ed3510f883c8acc8681b8df8da8d20e0f" + integrity sha512-VatMDBQ41nnd30knd3D+4sUHQaZAEcvljPp8SWD6JV5IRrKbcSevIrmulsyq7guuy0IWgSBJbjQf2mKksnvAMw== dependencies: - "@budibase/backend-core" "1.2.44-alpha.5" - "@budibase/types" "1.2.44-alpha.5" + "@budibase/backend-core" "1.2.44-alpha.6" + "@budibase/types" "1.2.44-alpha.6" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1207,10 +1207,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.2.44-alpha.5": - version "1.2.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.5.tgz#3de49c35291e37102b018cef4dd2f553e7121c23" - integrity sha512-ipOGpfUKvVnDtscujSKemTYgUMgFbmF+Sb/D5JUb58+A4vJz/F29hb5GjANv2x3Wm8BJtuG8NjhVm36rWV9kAg== +"@budibase/types@1.2.44-alpha.6": + version "1.2.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.6.tgz#c595b7c3416d8f81d0052f8c5137346375148132" + integrity sha512-lMDfimVOmRnDhJzExrqCEFnGpri1kmriKrw86ijI+1zIPrO4un3kAfCZBBJ0BeH12jCsi8ySJErQ1alshe92kg== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index b385798b94..b7026cd999 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "1.2.44-alpha.6", - "@budibase/pro": "1.2.44-alpha.5", + "@budibase/pro": "1.2.44-alpha.6", "@budibase/string-templates": "1.2.44-alpha.6", "@budibase/types": "1.2.44-alpha.6", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 5e1954241d..540a41b5ed 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.2.44-alpha.5": - version "1.2.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.5.tgz#f564ad4cc9b5e2cf080d1f5988fc6ffec44d6621" - integrity sha512-RPO4h+kB6c0ivVRGSoZAOrFQFLwv8qkkS7WNjToX1AZKD1umrMQrnEwi/sldjNW6ZAKFiktZAHDyWO/Mb7AP/g== +"@budibase/backend-core@1.2.44-alpha.6": + version "1.2.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.6.tgz#902a8a0857be675f1a8aaa10538794038b168cd0" + integrity sha512-vZ34uO/IoIbx+dgHTT9TVoVhGjldVyJyUl8RxlfLiDee5fzpghVuotlSu6FpeOkW5ZpPOpENRriN0fvwxUkI7g== dependencies: - "@budibase/types" "1.2.44-alpha.5" + "@budibase/types" "1.2.44-alpha.6" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -325,21 +325,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.2.44-alpha.5": - version "1.2.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.5.tgz#7ae5e593eccddb749da17df0354929eaaadc4e60" - integrity sha512-lfHDUsD0dRHg/NE71i1zCzVal89ceWilnTHdJ0om3TdZ7qkqtsRUIE8/pz+NoqNAjZ13qG0p75Ue+NEjI24lAQ== +"@budibase/pro@1.2.44-alpha.6": + version "1.2.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.6.tgz#40e4f61ed3510f883c8acc8681b8df8da8d20e0f" + integrity sha512-VatMDBQ41nnd30knd3D+4sUHQaZAEcvljPp8SWD6JV5IRrKbcSevIrmulsyq7guuy0IWgSBJbjQf2mKksnvAMw== dependencies: - "@budibase/backend-core" "1.2.44-alpha.5" - "@budibase/types" "1.2.44-alpha.5" + "@budibase/backend-core" "1.2.44-alpha.6" + "@budibase/types" "1.2.44-alpha.6" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.2.44-alpha.5": - version "1.2.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.5.tgz#3de49c35291e37102b018cef4dd2f553e7121c23" - integrity sha512-ipOGpfUKvVnDtscujSKemTYgUMgFbmF+Sb/D5JUb58+A4vJz/F29hb5GjANv2x3Wm8BJtuG8NjhVm36rWV9kAg== +"@budibase/types@1.2.44-alpha.6": + version "1.2.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.6.tgz#c595b7c3416d8f81d0052f8c5137346375148132" + integrity sha512-lMDfimVOmRnDhJzExrqCEFnGpri1kmriKrw86ijI+1zIPrO4un3kAfCZBBJ0BeH12jCsi8ySJErQ1alshe92kg== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From e006cad2cf31d18c2804ce3c7dbdde5ce5f06946 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 25 Aug 2022 09:35:57 +0100 Subject: [PATCH 5/5] Ensure the correct component is selected before executing component dropdown menu actions --- .../_components/navigation/ComponentDropdownMenu.svelte | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentDropdownMenu.svelte index faa8b9d552..5add1fedac 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentDropdownMenu.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentDropdownMenu.svelte @@ -2,9 +2,18 @@ import { store } from "builderStore" import { ActionMenu, MenuItem, Icon } from "@budibase/bbui" + export let component + $: noPaste = !$store.componentToPaste const keyboardEvent = (key, ctrlKey = false) => { + // Ensure this component is selected first + if (component._id !== $store.selectedComponentId) { + store.update(state => { + state.selectedComponentId = component._id + return state + }) + } document.dispatchEvent(new KeyboardEvent("keydown", { key, ctrlKey })) }