From d705992a3caa630988c1d0a0f7657ef34c2ce034 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Thu, 24 Sep 2026 12:10:37 +0200 Subject: [PATCH] fix: migrate stored settings to include all static providers (GonkaGate card appears for users with old single-provider save); bump 0.1.22 --- package.json | 2 +- src/settings.ts | 13 +++++++++++++ src/ui.tsx | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 688dbfd..bf6942e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "figma-ai-plugin", - "version": "0.1.21", + "version": "0.1.22", "private": true, "dependencies": { "@create-figma-plugin/ui": "^4.0.3", diff --git a/src/settings.ts b/src/settings.ts index 4aa71a9..a8b6dcf 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -86,6 +86,19 @@ export function loadSettings (): Promise { if (!Array.isArray(merged.providers) || merged.providers.length === 0) { merged.providers = defaults.providers merged.activeProviderId = defaults.providers[0].id + } else { + // Migration: ensure every provider type from defaults exists in stored settings. + // Old saves may have only one provider — add the missing static cards so the + // user gets both forms without having to reset. New providers get a fresh id. + const haveTypes = new Set(merged.providers.map(function (p) { return p.type })) + const missing = defaults.providers.filter(function (p) { return !haveTypes.has(p.type) }) + if (missing.length > 0) { + merged.providers = merged.providers.concat(missing) + } + // If the active id no longer exists, fall back to the first provider. + if (!merged.providers.some(function (p) { return p.id === merged.activeProviderId })) { + merged.activeProviderId = merged.providers[0].id + } } resolve(merged) }) diff --git a/src/ui.tsx b/src/ui.tsx index 87abbc4..0ff1895 100644 --- a/src/ui.tsx +++ b/src/ui.tsx @@ -30,7 +30,7 @@ const MIN_WINDOW_SIZE = { width: 320, height: 200 } // very high — actual clamp is done by main via clampWindowSize (bounds*zoom). // Full plugin version shown in the footer status bar. Keep in sync with package.json "version". -const PLUGIN_VERSION = '0.1.21' +const PLUGIN_VERSION = '0.1.22' const fieldStyle = { display: 'flex',