Files
windmill/frontend/src/lib/components/editorStoragePathContext.ts
T
AlexRV12andClaude Opus 5 fa73539839 fix(ai-chat): test_run_flow could test a different flow than the one asked (#11066)
* fix(ai-chat): test_run_flow could test a different flow than the one asked

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmQDoFXVPwYyEN8PfV2oL7

* fix(ai-chat): prefer the flow editor stored at the path over one renamed to it

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmQDoFXVPwYyEN8PfV2oL7

* test(ai-chat): default the flow helpers factory and trim duplicated setup

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmQDoFXVPwYyEN8PfV2oL7

* refactor(ai-chat): resolve the flow editor to run by its storage path

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmQDoFXVPwYyEN8PfV2oL7

* refactor(ai-chat): move the editor storage path context out of sessions

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TmQDoFXVPwYyEN8PfV2oL7

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 18:41:21 +00:00

20 lines
788 B
TypeScript

import { getContext, setContext } from 'svelte'
// The path an editor's draft is stored under, the same key the live-editor draft
// registers. Published by whichever ancestor owns it (the session tab, or the
// full-page editor) because the parts that must say which item an editor is open
// on sit below both, and the path they can see themselves is the renamed one.
const KEY = 'EditorStoragePath'
/** `undefined` where the editor has no stored draft to speak of (a drawer mount). */
export type EditorStoragePath = () => string | undefined
export function setEditorStoragePath(storagePath: EditorStoragePath): void {
setContext(KEY, storagePath)
}
export function getEditorStoragePath(): EditorStoragePath | undefined {
return getContext<EditorStoragePath | undefined>(KEY)
}