fix: guard every component under a session editor against the navigation workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-09-17 17:05:15 +02:00
co-authored by Claude Opus 5
parent 34aecb0d29
commit a4eb80bd8d
140 changed files with 988 additions and 649 deletions
@@ -19,7 +19,6 @@
CtxAppInput
} from '../../inputType'
import type { AppViewerContext } from '../../types'
import { workspaceStore } from '$lib/stores'
import { createEventDispatcher } from 'svelte'
import { deepEqual } from 'fast-equals'
import { computeFields } from './utils'
@@ -35,6 +34,9 @@
import FlowEditorDrawer from '$lib/components/flows/content/FlowEditorDrawer.svelte'
import { FlowService, ScriptService, type OpenFlow } from '$lib/gen'
import { replaceScriptPlaceholderWithItsValues } from '$lib/hub'
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
const operatingWorkspace = useOperatingWorkspace()
interface Props {
runnable: RunnableByPath
@@ -131,7 +133,7 @@
return
}
const loaded = await loadSchema($workspaceStore ?? '', runnable.path, 'flow')
const loaded = await loadSchema($operatingWorkspace ?? '', runnable.path, 'flow')
const schema = loaded?.schema ?? emptySchema()
if (!deepEqual(runnable.schema, schema)) {
runnable.schema = schema
@@ -167,7 +169,7 @@
async function openScriptEditor(path: string) {
try {
const script = await ScriptService.getScriptByPath({
workspace: $workspaceStore!,
workspace: $operatingWorkspace!,
path
})
scriptEditorDrawer?.openDrawer(script.hash, () => {
@@ -344,7 +346,7 @@
startIcon={{ icon: Eye }}
endIcon={{ icon: ExternalLink }}
target="_blank"
href="{base}/flows/get/{runnable.path}?workspace={$workspaceStore}"
href="{base}/flows/get/{runnable.path}?workspace={$operatingWorkspace}"
>
Details
</Button>
@@ -425,7 +427,7 @@
{#if runnable.runType == 'flow' && isHubFlowPath(runnable.path)}
Hub flow not found at {runnable.path}
{:else}
{runnable.runType} not found at {runnable.path} in workspace {$workspaceStore}
{runnable.runType} not found at {runnable.path} in workspace {$operatingWorkspace}
{/if}
</div>
{:else if runnable.runType == 'script' || runnable.runType == 'hubscript'}