@linxin666/dsh-client-ui-task-board 0.1.3 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-task-board",
3
3
  "description": "Task board for the dsh web GUI: a sidebar entry plus a multi-column kanban view with local persistence, task details, and real execution through dsh sessions (session.prompt). Hot-pluggable — mounted via ~/.dsh/cordis.patch.yml + a profile node_modules symlink, no dsh source changes.",
4
- "version": "0.1.3",
4
+ "version": "0.1.6",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",
@@ -92,26 +92,37 @@ export function mountSidebarEntry(controller: BoardController): () => void {
92
92
  let placed = false
93
93
 
94
94
  const tryPlace = (): void => {
95
- if (placed) return
96
95
  if (root !== undefined && !root.isConnected) {
97
- // The shell re-created the sidebar pane; re-query from scratch so the
98
- // entry is not re-inserted into a detached subtree (which would leave
99
- // it permanently invisible).
96
+ // The shell rebuilt the sidebar pane (whole-tree teardown); the root
97
+ // observer is gone with the old tree, so detach it and re-query from
98
+ // scratch. The new pane is later noticed by the body-level watcher.
99
+ rootObserver.disconnect()
100
100
  root = undefined
101
+ placed = false
102
+ }
103
+ if (placed) {
104
+ // Cheap short-circuit: entry still lives in a mountable subtree.
105
+ if (document.body.contains(entry)) return
106
+ // Entry was torn down together with the old tree; reset and re-place.
107
+ rootObserver.disconnect()
108
+ root = undefined
109
+ placed = false
101
110
  }
102
111
  root ??= sidebarRoot()
103
112
  if (root === undefined) return
104
113
  placed = placeEntry(root, entry)
105
114
  if (placed) {
106
115
  rootObserver.observe(root, { childList: true, subtree: true })
107
- // Placement done; the root observer alone keeps the entry healed.
108
- // Disconnect the body-wide watcher so unrelated app mutations (e.g.
109
- // chat streaming) no longer churn every plugin's self-heal loop.
110
- waitObserver.disconnect()
111
116
  }
112
117
  }
113
118
 
114
- // The shell renders after boot settlement; watch for its arrival.
119
+ // Body-level watcher retained as the "whole rebuild" fallback: when the shell
120
+ // tears down the whole sidebar pane, the root observer is gone with it and
121
+ // only this body observation can notice the new pane mounting. It is no
122
+ // longer disconnected after placement; the placed-and-still-mounted case
123
+ // short-circuits through the cheap document.body.contains(entry) check, so
124
+ // unrelated app mutations (e.g. chat streaming) cost one contains check
125
+ // instead of churning the full re-query.
115
126
  const waitObserver = new MutationObserver(() => { tryPlace() })
116
127
  waitObserver.observe(document.body, { childList: true, subtree: true })
117
128