mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-19 08:03:16 +00:00
* fix(frontend): restore heading sizes in note markdown and keep group notes on id change Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE * fix(frontend): scope the note cleanup deferral per note Address local review nits: the header comment overstated the heading ramp (h3 sits at body size in the xs and sm scales), and the mid-update deferral bailed out of cleanup for every group note rather than the one holding the unrendered module. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE * perf(frontend): traverse modules without collecting a discarded array Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE * test(frontend): show the three markdown prose presets in the kitchen sink The Markdown tab rendered only the default preset, so a change to the shared heading scale could not be compared across the surfaces that use it. The chat sample gains headings for the same reason: it is the only place the assistant bubble renders at panel width without an AI provider. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE * refactor(frontend): validate group notes against the flow, not the render A group note's members are module ids, so the flow's own module list decides whether one still exists. Validating against the rendered nodes instead needed a special case for collapsed groups, and still dropped a live module in the pass after its id changed. Both cases are the same mistake, and checking the source of truth removes them together with the collapsedModuleIds parameter. Path completion keeps working off the rendered graph, since it needs the edges, and now skips a note whose members it cannot all see rather than dropping them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE * fix(frontend): name a new note "Note", not after its internal type The prefill lands inside the user's own note, and "Free note" / "Group note" are the serialized type, not words anyone says about a note they just drew. The menus that create them already say "Add note". The heading goes to h2 as well: h3 computes to the body size in the note scale, so the prefill's own title did not read as one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE * docs(frontend): describe what collapsedModuleIds is still for Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182GroR5mvi9ksRTMmBT7nE --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest'
|
|
|
|
// Mock modules that transitively import CSS/Monaco
|
|
vi.mock('monaco-editor', () => ({}))
|
|
vi.mock('@xyflow/svelte', () => ({}))
|
|
|
|
import type { FlowModule, OpenFlow } from '$lib/gen'
|
|
import type { StateStore } from '$lib/utils'
|
|
import type { ExtendedOpenFlow } from '../flows/types'
|
|
import { NoteEditor } from './noteEditor.svelte'
|
|
|
|
function makeFlowStore(
|
|
moduleIds: string[],
|
|
containedNodeIds: string[]
|
|
): StateStore<ExtendedOpenFlow> {
|
|
const modules: FlowModule[] = moduleIds.map((id) => ({
|
|
id,
|
|
value: { type: 'rawscript', content: '', language: 'bun' } as any
|
|
}))
|
|
const flow: OpenFlow = {
|
|
summary: '',
|
|
value: {
|
|
modules,
|
|
notes: [
|
|
{
|
|
id: 'note',
|
|
text: 'note',
|
|
color: 'yellow',
|
|
type: 'group',
|
|
contained_node_ids: containedNodeIds
|
|
}
|
|
]
|
|
},
|
|
schema: {}
|
|
}
|
|
return { val: flow as ExtendedOpenFlow } as StateStore<ExtendedOpenFlow>
|
|
}
|
|
|
|
function containedIds(flowStore: StateStore<ExtendedOpenFlow>): string[] | undefined {
|
|
return flowStore.val.value.notes?.[0]?.contained_node_ids
|
|
}
|
|
|
|
describe('cleanupGroupNotes', () => {
|
|
it('keeps a module the graph has not rendered', () => {
|
|
// Both the pass after a module id changed and a collapsed group leave a live module
|
|
// out of the rendered nodes.
|
|
const flowStore = makeFlowStore(['renamed', 'b'], ['renamed', 'b'])
|
|
new NoteEditor(flowStore).cleanupGroupNotes([{ id: 'b' }])
|
|
|
|
expect(containedIds(flowStore)).toEqual(['renamed', 'b'])
|
|
})
|
|
|
|
it('drops a module that no longer exists in the flow', () => {
|
|
const flowStore = makeFlowStore(['b'], ['deleted', 'b'])
|
|
new NoteEditor(flowStore).cleanupGroupNotes([{ id: 'b' }])
|
|
|
|
expect(containedIds(flowStore)).toEqual(['b'])
|
|
})
|
|
})
|