feat(home): gate local-only New rows behind the global AI dev flag

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-05-26 15:17:56 +02:00
co-authored by Claude Opus 4.7
parent d6376fa9d5
commit 00ac8905de
@@ -13,6 +13,7 @@
} from '$lib/gen'
import { userStore, workspaceStore } from '$lib/stores'
import { UserDraft } from '$lib/userDraft.svelte'
import { isGlobalAiEnabled } from '$lib/components/copilot/chat/global/gate'
import type uFuzzy from '@leeoniya/ufuzzy'
import {
ChevronsDownUp,
@@ -84,28 +85,30 @@
// the same tab don't emit `storage` events, so we also refresh on window
// focus (returning from an editor) and on the row reload events.
let localDraftToken = $state(0)
// Local-only "New" rows are part of the global AI draft experience — gate them
// behind the same dev flag as the rest of that feature.
let localScriptDrafts = $derived.by(() => {
localDraftToken
return $workspaceStore
return $workspaceStore && isGlobalAiEnabled()
? UserDraft.list<Partial<Script>>({ workspace: $workspaceStore, itemKinds: ['script'] })
: []
})
let localFlowDrafts = $derived.by(() => {
localDraftToken
return $workspaceStore
return $workspaceStore && isGlobalAiEnabled()
? UserDraft.list<Partial<Flow>>({ workspace: $workspaceStore, itemKinds: ['flow'] })
: []
})
// app/raw_app draft values don't carry a path — the storage key is the path.
let localAppDrafts = $derived.by(() => {
localDraftToken
return $workspaceStore
return $workspaceStore && isGlobalAiEnabled()
? UserDraft.list<{ summary?: string }>({ workspace: $workspaceStore, itemKinds: ['app'] })
: []
})
let localRawAppDrafts = $derived.by(() => {
localDraftToken
return $workspaceStore
return $workspaceStore && isGlobalAiEnabled()
? UserDraft.list<{ summary?: string }>({ workspace: $workspaceStore, itemKinds: ['raw_app'] })
: []
})