fix(workspaces): resolve slot list binding regression

Port 2.0
This commit is contained in:
purian23 committed 2026-10-28 07:15:07 -04:00
1 parent 7479d4bb79
commit 4f0e2c6fd4
1 file changed
+14 -8
+14 -8
View File
@@ -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;