velxio/frontend/src/components
David Montero Crespo 701042fa22 fix(perf): un-freeze the editor during fast-toggling simulations (ESP32 clock)
Running a multiplexed 4-digit 7-segment clock on ESP32/QEMU froze the
browser for minutes after Run — evaluate probes waited 40-90 s, and before
the first fixes the sim WebSocket eventually died (code 1006) with the page
never recovering. CPU-profiled on staging; four compounding per-GPIO-edge
costs, in profile order:

updateComponentState minted a new components array per edge
------------------------------------------------------------
The store setter rebuilt `components` (and one properties object) on EVERY
edge even when the state didn't change. The breadboard is direct-wired to
13 board pins, so segment toggles produced thousands of store sets per
second; every subscriber re-rendered each time, and the canvas subscription
effect (deps: [components, ...]) re-subscribed all pin listeners in a loop.
Now a no-op guard returns prevState unchanged, and breadboards are treated
as self-managed (they have no visual on/off state to echo).

CompilationConsole re-rendered every log line per editor render
----------------------------------------------------------------
The post-compile console holds hundreds of lines; each render called
Date.toLocaleTimeString per line (~0.2 ms each — it builds a fresh Intl
formatter every call). Profile: 162 s of self time in LogLine over a 337 s
window, in ~150 ms tasks. LogLine is now memoized (entries are immutable),
timestamps go through one shared Intl.DateTimeFormat, and the console
itself is React.memo'd against parent re-renders.

Per-edge full SPICE re-solves
------------------------------
PinManager requested a FULL netlist rebuild+solve on every 'mcu' edge.
Now only the edge that newly classifies a pin as MCU-output triggers the
rebuild (that's what emits the pin's V-source); steady-state updates flow
through connectMcuEdgesToService's per-pin coalesced alterSource path.
The start.ts resolve hook is trailing-throttled (33 ms) for the other
per-edge callers (RP2040, custom chips), the service's pending-edge queue
drains on a 33 ms gap timer instead of replaying back-to-back, and new
edges arriving inside the gap queue instead of soloing a solve.
STM32 / Pi reverse pin-name mappings added to connectMcuEdgesToService so
those boards keep fine-grained updates now that the full-tick storm is
gone (PA0/PC13-style and GPIO-style names never matched before).

wokwi-7segment re-rendered per segment write
---------------------------------------------
element.values now flushes at most every 8 ms per display (trailing write
guaranteed), instead of re-rendering the 32-shape SVG per edge.

Also: CLN (colon) pin support for 7-segment clock faces — wired CLN now
drives colon/colonValue in both the attachEvents path and the QEMU
onPinStateChange path; it was silently ignored, so clock colons never lit.

Verified on staging with the failing project: main-thread probes drop from
40-90 s waits (324 long tasks, 52.6 s blocked in 150 s) to 5-11 ms
(2 long tasks, 179 ms), display shows 12:00 with the colon blinking at
1 Hz from the first seconds after Run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 01:15:59 +02:00
..
analog-ui feat(breadboard): hover-gated labels + full-footprint seating solver 2026-07-19 05:28:40 +02:00
components-instruments refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
customChips refactor(custom-chips): move the AI entry point out of OSS into an overlay slot 2026-07-17 04:36:14 +02:00
editor fix(perf): un-freeze the editor during fast-toggling simulations (ESP32 clock) 2026-07-21 01:15:59 +02:00
examples redesign(examples): compact toolbar + denser grid + fix card black bars 2026-07-16 06:09:02 +02:00
layout feat(editor): follow-up GitHub star prompt for past dismissers 2026-06-15 22:15:14 +02:00
raspberry-pi feat(ui): replace native confirm() dialogs with reusable modal 2026-07-18 01:59:18 +02:00
simulator fix(perf): un-freeze the editor during fast-toggling simulations (ESP32 clock) 2026-07-21 01:15:59 +02:00
ui feat(ui): replace native confirm() dialogs with reusable modal 2026-07-18 01:59:18 +02:00
velxio-components feat(ssd1306): add the 4-pin I2C OLED module + examples on Uno/ESP32/Pico/STM32 2026-07-09 23:13:50 +02:00
ComponentPickerModal.css fix(canvas): stack pins with their component + pickers above floating panels 2026-07-17 18:44:58 +02:00
ComponentPickerModal.tsx fix(picker): Pi family component cards — full illustrations + PRO badge 2026-07-21 00:19:01 +02:00
DynamicComponent.tsx fix(trace): recognise runtime boards and same-hole junctions in pin tracing 2026-07-20 18:46:23 +02:00