fix(web): reapply broker config on change instead of short-circuiting#81
Merged
Conversation
MqttManager::connect() returns early on "already connected" before applying the supplied config, so editing a broker's url/credentials while it was connected never took effect. flow_update now detects a changed config on a live broker and disconnects first so the reconnect applies the new config. disconnect() drops the broker-side subscriptions, so the broker's tracked figma_subscriptions are cleared at the same time; the existing subscription reconciliation then re-subscribes those topics on the fresh connection rather than treating them as still-live and skipping them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CI runs `cargo clippy --workspace --all-targets -- -D warnings -W clippy::pedantic`. The wildcard arm in compare_expr matched only the remaining Boolean variant, tripping match_wildcard_for_single_variants and failing the Rust check — red on main since before this branch, so it also blocked this PR. Name the Boolean arm explicitly: the match is now exhaustive and a future variant is a compile error instead of a silent fall-through. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3db45dc to
9fa81b8
Compare
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.
Problem
MqttManager::connect()short-circuits on "already connected" before applying the suppliedBrokerConfig. So editing a broker's URL or credentials while it was connected silently never took effect — the flow kept using the old connection.This surfaced while fixing the broader subscription churn (already on
main): the per-flow_updateauto-connect now detects an unchanged config and skips, but a changed config still needs to actually reconnect.Fix
In
flow_update's broker auto-connect loop:disconnect()first, then connect, so the new URL/creds apply.disconnect()drops the broker-side subscriptions, so the broker's trackedfigma_subscriptionsare cleared at the same time. The existing subscription reconciliation then re-subscribes those topics on the fresh connection instead of treating them as still-live and skipping them.Scope
One file:
apps/web/src-tauri/src/runtime/commands.rs(+19/−5). Browser (wasm) runtime has no MQTT, so it's unaffected.Verification
cargo check -p microflow✓cargo clippy -p microflow→ no issues ✓🤖 Generated with Claude Code