From 6c9347799866d520665c14dae6cbbe9606de2441 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Wed, 27 Nov 2024 09:22:34 +1100 Subject: [PATCH] fix: background migration not working properly --- src/manifests/manifest.json | 4 ++++ src/seqta/utils/migration/migration-iframe.ts | 18 +++++++++++++++++- tailwind.config.js | 9 +-------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/manifests/manifest.json b/src/manifests/manifest.json index 72cdf633..35466761 100644 --- a/src/manifests/manifest.json +++ b/src/manifests/manifest.json @@ -40,6 +40,10 @@ { "resources": ["resources/icons/*"], "matches": ["*://*/*"] + }, + { + "resources": ["seqta/utils/migration/migrate.html"], + "matches": ["*://*/*"] } ] } diff --git a/src/seqta/utils/migration/migration-iframe.ts b/src/seqta/utils/migration/migration-iframe.ts index bd42f4d9..f7716591 100644 --- a/src/seqta/utils/migration/migration-iframe.ts +++ b/src/seqta/utils/migration/migration-iframe.ts @@ -44,7 +44,23 @@ const getSelectedBackground = (): string | null => { const startMigration = async () => { try { console.info('Starting background extraction...'); - const backgrounds = await getAllBackgrounds(); + let backgrounds: Data[]; + try { + backgrounds = await getAllBackgrounds(); + if (!backgrounds || backgrounds.length === 0) { + console.info('No backgrounds to migrate'); + window.parent.postMessage({ type: 'MIGRATION_COMPLETE' }, '*'); + return; + } + } catch (error: any) { + if (error.name === 'NotFoundError' && error.message.includes('object stores was not found')) { + console.info('No backgrounds to migrate: object store not found'); + window.parent.postMessage({ type: 'MIGRATION_COMPLETE' }, '*'); + return; + } + console.error('Error fetching backgrounds:', error); + throw new Error('Failed to fetch backgrounds'); + } const selectedBackground = getSelectedBackground(); console.info(`Found ${backgrounds.length} backgrounds`); diff --git a/tailwind.config.js b/tailwind.config.js index 67df1fdf..383a3120 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,17 +1,10 @@ -const { - default: flattenColorPalette, -} = require("tailwindcss/lib/util/flattenColorPalette"); +import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette"; /** @type {import('tailwindcss').Config} */ export default { content: [ "./src/**/*.{js,ts,jsx,tsx,html,svelte}", ], - //safelist: [ - //{ - // pattern: / */, - //} - //], darkMode: "class", theme: { fontSize: {