Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(cloud): migrate column preferences and restore table caption

Timothy Yin052ac6151e29
diff --git a/apps/cloud/app/components/CloudPhotoLibrary.vue b/apps/cloud/app/components/CloudPhotoLibrary.vue
index e3f0b71e..7b0a3654 100644
--- a/apps/cloud/app/components/CloudPhotoLibrary.vue
+++ b/apps/cloud/app/components/CloudPhotoLibrary.vue
@@ -82,6 +82,7 @@ const rows = computed(() => {
})
const columnVisibility = useDashboardPhotoColumnVisibility({
storageKey: 'cloud-photos-column-visibility',
+ legacyStorageKey: 'dashboard-photos-column-visibility',
hidden: ['id'],
locked: ['thumbnailUrl', 'actions'],
})
diff --git a/apps/cloud/app/components/CloudPricing.vue b/apps/cloud/app/components/CloudPricing.vue
index 98861354..20e1ecfd 100644
--- a/apps/cloud/app/components/CloudPricing.vue
+++ b/apps/cloud/app/components/CloudPricing.vue
@@ -379,7 +379,7 @@ async function checkout(plan: any) {
class="cf-plan-comparison-table"
:data="comparisonRows"
:columns="comparisonColumns"
- :aria-label="$t('cloud.billing.compare')"
+ :caption="$t('cloud.billing.compare')"
/></section
></template>
<CloudLegalLinks />
diff --git a/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts b/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
index 3575201e..bd298836 100644
--- a/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
+++ b/packages/console/app/composables/useDashboardPhotoColumnVisibility.ts
@@ -1,4 +1,5 @@
import { useLocalStorage } from '@vueuse/core'
+import { onMounted } from 'vue'
const DASHBOARD_PHOTO_COLUMN_VISIBILITY_STORAGE_KEY =
'dashboard-photos-column-visibility'
@@ -62,20 +63,47 @@ function mergeColumnVisibility(
export function useDashboardPhotoColumnVisibility(
options: {
storageKey?: string
+ legacyStorageKey?: string
hidden?: readonly DashboardPhotoColumnId[]
locked?: readonly DashboardPhotoColumnId[]
} = {},
) {
- return useLocalStorage<DashboardPhotoColumnVisibility>(
- options.storageKey ?? DASHBOARD_PHOTO_COLUMN_VISIBILITY_STORAGE_KEY,
- () => ({
- ...createDefaultColumnVisibility(),
- ...Object.fromEntries((options.hidden ?? []).map((id) => [id, false])),
- }),
- {
- mergeDefaults: (stored, defaults) =>
- mergeColumnVisibility(stored, defaults, options.locked),
- initOnMounted: true,
- },
- )
+ const key =
+ options.storageKey ?? DASHBOARD_PHOTO_COLUMN_VISIBILITY_STORAGE_KEY
+ const defaults = () => ({
+ ...createDefaultColumnVisibility(),
+ ...Object.fromEntries((options.hidden ?? []).map((id) => [id, false])),
+ })
+ // Register before useLocalStorage's mounted read so migration precedes initialization.
+ const legacyKey = options.legacyStorageKey
+ if (legacyKey)
+ onMounted(() => {
+ try {
+ const storage = window.localStorage
+ if (storage.getItem(key) !== null) return
+ const raw = storage.getItem(legacyKey)
+ if (raw === null) return
+ const legacy = JSON.parse(raw)
+ if (!legacy || typeof legacy !== 'object' || Array.isArray(legacy))
+ return
+ const migrated = mergeColumnVisibility(
+ {
+ ...legacy,
+ ...Object.fromEntries(
+ (options.hidden ?? []).map((id) => [id, false]),
+ ),
+ },
+ defaults(),
+ options.locked,
+ )
+ storage.setItem(key, JSON.stringify(migrated))
+ } catch {
+ // Invalid legacy data or unavailable storage must not prevent opening the library.
+ }
+ })
+ return useLocalStorage<DashboardPhotoColumnVisibility>(key, defaults, {
+ mergeDefaults: (stored, defaults) =>
+ mergeColumnVisibility(stored, defaults, options.locked),
+ initOnMounted: true,
+ })
}