fix: clear computedDisabled on concrete widget during promoted slot drawing

The concrete widget created from the interior POJO inherits computedDisabled=true, which suppresses arrow buttons and display values for numeric widgets on the SubgraphNode.

Amp-Thread-ID: https://ampcode.com/threads/T-019c5575-c485-767b-a7d1-adccefa4f60e
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-02-12 21:40:09 -08:00
parent 6073ba35a8
commit 5fea1ec3a1
2 changed files with 30 additions and 2 deletions

View File

@@ -400,6 +400,32 @@ describe('PromotedWidgetSlot', () => {
expect(spy).toHaveBeenCalled()
})
it('clears computedDisabled on concrete widget before drawing', () => {
const interiorWidget = createMockWidget({ type: 'number' })
const interiorNode = {
id: '5',
widgets: [interiorWidget]
} as unknown as LGraphNode
const subNode = createMockSubgraphNode({ '5': interiorNode })
const slot = new PromotedWidgetSlot(subNode, '5', 'seed')
const concreteWidget = {
y: 0,
computedDisabled: true,
promoted: true,
drawWidget: vi.fn(function (this: { computedDisabled?: boolean }) {
expect(this.computedDisabled).toBe(false)
})
} as unknown as BaseWidget<IBaseWidget>
vi.mocked(toConcreteWidget).mockReturnValueOnce(concreteWidget)
const ctx = createMockCtx()
slot.drawWidget(ctx, { width: 200, showText: true })
expect(concreteWidget.drawWidget).toHaveBeenCalled()
})
it('does not mutate concrete widget y/last_y during rendering', () => {
const interiorWidget = createMockWidget({ type: 'number' })
const interiorNode = {

View File

@@ -259,10 +259,12 @@ export class PromotedWidgetSlot extends BaseWidget<IBaseWidget> {
: null
if (concrete) {
// Suppress promoted border: the purple outline should only appear on
// the source node inside the subgraph, not on the SubgraphNode.
// Suppress promoted border and disabled state: the purple outline and
// linked-disabled flag should only apply on the source node inside the
// subgraph, not on the SubgraphNode.
const wasPromoted = concrete.promoted
concrete.promoted = false
concrete.computedDisabled = false
concrete.computedHeight = this.computedHeight
ctx.save()