fix: Fix unsafe cast in Input.setVisible(). (#8695)

This commit is contained in:
Aaron Dodson
2025-01-06 10:52:02 -08:00
committed by GitHub
parent d2c2d6b554
commit 54ebfb7a0e

View File

@@ -20,7 +20,7 @@ import type {Connection} from '../connection.js';
import type {ConnectionType} from '../connection_type.js';
import type {Field} from '../field.js';
import * as fieldRegistry from '../field_registry.js';
import type {RenderedConnection} from '../rendered_connection.js';
import {RenderedConnection} from '../rendered_connection.js';
import {Align} from './align.js';
import {inputTypes} from './input_types.js';
@@ -181,15 +181,14 @@ export class Input {
for (let y = 0, field; (field = this.fieldRow[y]); y++) {
field.setVisible(visible);
}
if (this.connection) {
const renderedConnection = this.connection as RenderedConnection;
if (this.connection && this.connection instanceof RenderedConnection) {
// Has a connection.
if (visible) {
renderList = renderedConnection.startTrackingAll();
renderList = this.connection.startTrackingAll();
} else {
renderedConnection.stopTrackingAll();
this.connection.stopTrackingAll();
}
const child = renderedConnection.targetBlock();
const child = this.connection.targetBlock();
if (child) {
child.getSvgRoot().style.display = visible ? 'block' : 'none';
}