From d954d00170764550eae6daea8a7ff4d03bff9a56 Mon Sep 17 00:00:00 2001 From: John Leider Date: Thu, 25 Jun 2026 16:44:43 -0500 Subject: [PATCH 1/2] feat(useFeatures): add persist option to createFeaturesPlugin Setting persist: true saves the set of enabled feature flags to storage and reconciles them against the registered flags on load, so a user's feature toggles survive a page reload. Wires the existing createPluginContext persist/restore hooks; the selected flag ids round-trip through storage keyed by the plugin namespace. --- .changeset/features-persist-option.md | 7 +++++++ .../0/src/composables/useFeatures/index.ts | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .changeset/features-persist-option.md diff --git a/.changeset/features-persist-option.md b/.changeset/features-persist-option.md new file mode 100644 index 000000000..383b94359 --- /dev/null +++ b/.changeset/features-persist-option.md @@ -0,0 +1,7 @@ +--- +"@vuetify/v0": minor +--- + +feat(useFeatures): add `persist` option to `createFeaturesPlugin` + +Setting `persist: true` saves the set of enabled feature flags to storage and reconciles them against the registered flags on load, so a user's feature toggles survive a page reload. Backed by the existing `createPluginContext` persist/restore hooks and keyed by the plugin namespace. diff --git a/packages/0/src/composables/useFeatures/index.ts b/packages/0/src/composables/useFeatures/index.ts index bd8bb84fa..38c636712 100644 --- a/packages/0/src/composables/useFeatures/index.ts +++ b/packages/0/src/composables/useFeatures/index.ts @@ -101,6 +101,16 @@ export interface FeaturePluginOptions extends FeatureContextOptions { * @remarks Adapters provide dynamic flag values from external services. */ adapter?: MaybeArray + /** + * Persist enabled feature flags to storage and restore them on load. + * + * @remarks Persists the set of selected flag ids, keyed by the plugin + * namespace. On load the selection is reconciled against the registered + * flags, so a user's toggles survive a page reload. + * + * @default false + */ + persist?: boolean } /** @@ -216,6 +226,16 @@ export const [createFeaturesContext, createFeaturesPlugin, useFeatures] = options => createFeatures(options), { fallback: () => createFeaturesFallback(), + persist: context => [...context.selectedIds], + restore: (context, saved) => { + if (!isArray(saved)) return + + const wanted = new Set(saved) + for (const ticket of context.values()) { + if (wanted.has(ticket.id)) context.select(ticket.id) + else context.unselect(ticket.id) + } + }, setup: (context, app, { adapter }) => { if (!adapter) return From 6c0965e1aeb1b6de9ecc7ba709eef8e4f919dfc1 Mon Sep 17 00:00:00 2001 From: John Leider Date: Thu, 25 Jun 2026 16:44:43 -0500 Subject: [PATCH 2/2] docs: persist devmode via createFeaturesPlugin persist option Drops the hand-rolled devmode persistence (manual localStorage read in zero.ts and duplicate watch+storage.set in AppBar and AppSettingsSheet) in favor of createFeaturesPlugin({ persist: true }). --- apps/docs/src/components/app/AppBar.vue | 12 ++---------- apps/docs/src/components/app/AppSettingsSheet.vue | 7 +------ apps/docs/src/plugins/zero.ts | 3 ++- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/apps/docs/src/components/app/AppBar.vue b/apps/docs/src/components/app/AppBar.vue index a647106e9..81ae1d031 100644 --- a/apps/docs/src/components/app/AppBar.vue +++ b/apps/docs/src/components/app/AppBar.vue @@ -1,6 +1,6 @@ diff --git a/apps/docs/src/components/app/AppSettingsSheet.vue b/apps/docs/src/components/app/AppSettingsSheet.vue index 322eaa079..74bdf192f 100644 --- a/apps/docs/src/components/app/AppSettingsSheet.vue +++ b/apps/docs/src/components/app/AppSettingsSheet.vue @@ -1,6 +1,6 @@