fix: migrate stored settings to include all static providers (GonkaGate card appears for users with old single-provider save); bump 0.1.22
This commit is contained in:
1 parent
c4f7e853b1
commit
d705992a3c
3 files changed
+15
-2
No files matched your search
+1
-1
@@ -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",
|
||||
|
||||
@@ -86,6 +86,19 @@ export function loadSettings (): Promise<Settings> {
|
||||
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)
|
||||
})
|
||||
|
||||
+1
-1
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user