From 4f0e2c6fd4b4e186e786a4d482ce0cd9762838c2 Mon Sep 17 00:00:00 2001 From: purian23 Date: Wed, 28 Oct 2026 07:15:07 -0400 Subject: [PATCH] fix(workspaces): resolve slot list binding regression Port 2.0 --- quickshell/Widgets/WorkspaceSwitcherModel.qml | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/quickshell/Widgets/WorkspaceSwitcherModel.qml b/quickshell/Widgets/WorkspaceSwitcherModel.qml index e67e95803..c7ebdc6de 100644 --- a/quickshell/Widgets/WorkspaceSwitcherModel.qml +++ b/quickshell/Widgets/WorkspaceSwitcherModel.qml @@ -94,20 +94,26 @@ QtObject { const live = {}; const slots = raw.map(ws => { const key = ws.id !== null && ws.id !== undefined && !ws.special ? ws.id : (ws.special ? "special:" : "name:") + (ws.name ?? ""); - let slot = _slotPool[key]; - if (!slot) { - slot = _slotComponent.createObject(root); - _slotPool[key] = slot; + let entry = _slotPool[key]; + if (!entry) { + entry = { + "slot": _slotComponent.createObject(root), + "ws": null + }; + _slotPool[key] = entry; + } + // Compare against the cached record: reading slot.ws here would make workspaceList depend on the write below (binding loop) + if (entry.ws !== ws) { + entry.ws = ws; + entry.slot.ws = ws; } - if (slot.ws !== ws) - slot.ws = ws; live[key] = true; - return slot; + return entry.slot; }); for (const key in _slotPool) { if (live[key]) continue; - _slotPool[key].destroy(); + _slotPool[key].slot.destroy(); delete _slotPool[key]; } return slots;