Load each bar widget's component once

Qt.createComponent is asynchronous, but a widget was only recorded in
pluginWidgetComponents once its component finished. syncPluginWidgets runs
several times while the shell starts, and every pass that ran while a load
was still in flight could not tell it apart from one that had never
happened — so it started a second load of the same URL. All twenty bar
widgets were loaded twice.

The duplicate component then replaced the first in the registry, and
swapping a slot's component makes its Loader build the replacement before
dropping the original. Both were briefly live, and both registered the
widget's IPC handler, which is where the "another handler is registered
for target" warnings came from.

Claim the key when the load starts instead, and release it if the
component fails so a later rescan can retry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-26 22:19:57 -07:00
co-authored by Claude Opus 5
parent e31355bbaf
commit 64810d815b
2 changed files with 36 additions and 4 deletions
+14
View File
@@ -230,6 +230,19 @@ for panel_id in omarchy.audio omarchy.bluetooth omarchy.monitor omarchy.network
done
pass "direct panel IPC opens and closes default panels"
# Each widget registers its IPC handler once while the shell starts. A second
# registration for the same target means two instances of that widget were
# live at once, which is what duplicate component loads produced: every sync
# pass that ran while a widget's asynchronous load was still in flight started
# a second load, and swapping a slot's component builds the replacement before
# dropping the original. Checked before the reload below, which rebuilds
# widgets by design.
if grep -q "another handler is registered for target" "$log"; then
grep "another handler is registered for target" "$log" | sed 's/^/ /' | head -20 >&2
fail_with_log "each widget registers its IPC handler once while starting"
fi
pass "each widget registers its IPC handler once while starting"
HOME="$test_home" OMARCHY_PATH="$test_root" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-bar-plugin" remove omarchy.audio
for _ in {1..80}; do
@@ -257,3 +270,4 @@ jq -e 'all(.[]; .id != "omarchy.audio")' <<<"$geometry" >/dev/null || {
}
pass "bar remove reloads shell config and updates bar layout"