Stop MidiStatus polling forever - #107
Merged
Merged
Conversation
The 2 s interval called loadDevices() unconditionally for the life of the panel and double-stringified connection state to compare it, even though hardware device changes are already delivered event-driven via midiService.onDeviceChange. The poll's only unique job is catching virtual synth initialization, which JZZ never reports, so it now stops as soon as the synth is observed (or after 60 s), skips ticks while the tab is hidden with a catch-up refresh on visibilitychange, and connection state changes are detected with a shallow field compare against the live previous state (fixing a stale-closure comparison) and refreshed from the device change callback as well. Fixes #101 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 12, 2026
Stop MidiStatus polling forever e8de18a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #101
The 2 s interval called
loadDevices()unconditionally for the life of the MIDI panel and compared connection state by doubleJSON.stringify— against a stale closure, so the comparison could also be wrong.Changes
getOutputDevices()whenvirtualMidiService.initialized; JZZ emits no change event for it). It now stops permanently as soon as the synth is observed — whichloadDevices()itself triggers, so in practice one or two ticks — or after 60 s.document.hidden, but initialization and timeout completion checks still clear the interval while hidden; one catch-up refresh runs onvisibilitychange.connectionStatusfields via functionalsetState(fixes the stale closure), and are also refreshed from the existingonDeviceChangecallback so auto-reconnect status stays event-driven.MidiServicerecords hardware removals before notifying device-change listeners, so callbacks observe the completed disconnection state.Hardware device arrival/removal remains event-driven via
midiService.onDeviceChange.Full suite 1065/1065 green;
tsc --noEmitand the production build are clean.🤖 Generated with Claude Code