@kernhq/module-quire 0.10.6 → 0.10.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernhq/module-quire",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "description": "Kern Quire: collaborative documents, spaces and page trees",
5
5
  "homepage": "https://github.com/KernAIO/module-quire#readme",
6
6
  "license": "AGPL-3.0-only",
@@ -10,6 +10,7 @@ import {
10
10
  session,
11
11
  } from '@kernhq/ui'
12
12
  import { createQuery, useQueryClient } from '@tanstack/svelte-query'
13
+ import { untrack } from 'svelte'
13
14
  import { getQuireApi } from '../api-instance.js'
14
15
  import { t } from '../i18n.js'
15
16
  import { buildPageTree, type PageTreeNode } from '../index.js'
@@ -76,18 +77,31 @@ const matches = $derived(
76
77
  query ? nodes.filter((n) => (n.title || t('untitled')).toLowerCase().includes(query)) : [],
77
78
  )
78
79
 
79
- /** A page opened from a link may be nested; its ancestors have to be open for it to be visible. */
80
+ /**
81
+ * A page opened from a link may be nested; its ancestors have to be open for it to be visible.
82
+ *
83
+ * `expanded` is read through `untrack` because this effect also writes it. Tracked, the write makes
84
+ * the effect its own trigger: collapsing an ancestor of the open page removed it from the set, the
85
+ * effect re-ran and put it straight back, and the disclosure was inert — click it, press Enter on
86
+ * it, nothing moves. That is the "effect that reads a flag it also clears" trap already written
87
+ * down in shell's CLAUDE.md, and it was invisible until `navigation.params.page` started arriving:
88
+ * with `activePageId` permanently null the loop never ran at all.
89
+ *
90
+ * What genuinely selects this effect is which page is open and what the tree contains. Whether a
91
+ * disclosure is open is the *result*, and a result must not be an input.
92
+ */
80
93
  $effect(() => {
81
94
  if (!activePageId || nodes.length === 0) return
82
95
  const byId = new Map(nodes.map((n) => [n.id, n]))
83
- const next = new Set(expanded)
96
+ const current = untrack(() => expanded)
97
+ const next = new Set(current)
84
98
  let cursor = byId.get(activePageId)?.parentId ?? null
85
99
  let guard = 0
86
100
  while (cursor && guard++ < 100) {
87
101
  next.add(cursor)
88
102
  cursor = byId.get(cursor)?.parentId ?? null
89
103
  }
90
- if (next.size !== expanded.size) expanded = next
104
+ if (next.size !== current.size) expanded = next
91
105
  })
92
106
 
93
107
  function toggle(id: string) {