mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-29 00:03:09 +00:00
fix: refuse a move while an editor holds text that is not valid JSON
That text never reaches the draft, and the move closes the editor holding it. The move now refuses before closing anything, as opening a session from a page drawer already does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d7b38031af
commit
d7f0df0315
@@ -5,7 +5,10 @@ import { UserDraftDbSyncer } from '$lib/userDraftDbSyncer.svelte'
|
||||
import { invalidateWorkspaceDrafts } from '$lib/workspaceDrafts.svelte'
|
||||
import { invalidateWorkspaceDiffCache } from '$lib/components/copilot/chat/global/diffSnapshot'
|
||||
import { logFeatureUsage } from '$lib/utils/featureUsage'
|
||||
import { flushAllPendingEditorChanges } from '$lib/components/pendingEditorFlush'
|
||||
import {
|
||||
anyEditorUnparseable,
|
||||
flushAllPendingEditorChanges
|
||||
} from '$lib/components/pendingEditorFlush'
|
||||
import { flushEditorSaves } from './useUserDraftSync.svelte'
|
||||
import {
|
||||
materializeForkOutcome,
|
||||
@@ -44,6 +47,10 @@ export type MoveSessionResult =
|
||||
*/
|
||||
export async function flushPendingSaves(workspace: string): Promise<string | undefined> {
|
||||
flushAllPendingEditorChanges()
|
||||
// Text that does not parse never reaches the draft, and the move closes the editor holding it.
|
||||
if (anyEditorUnparseable()) {
|
||||
return 'An editor has changes that are not valid JSON. Fix them before moving.'
|
||||
}
|
||||
await tick()
|
||||
flushEditorSaves(workspace)
|
||||
await tick()
|
||||
|
||||
Reference in New Issue
Block a user