Skip to content

Commit 9316f3b

Browse files
committed
Update closest tree component on owner update to see if the structure changed
1 parent f45da51 commit 9316f3b

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

packages/debugger/src/structure/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ export function createStructure<TEl extends object>(props: {
5858
let shouldUpdateAllRoots = true
5959

6060
const onComputationUpdate: walker.ComputationUpdateHandler = (
61-
rootId, owner, changedStructure,
61+
root_id, owner, changed_structure,
6262
) => {
6363
// separate the callback from the computation
6464
queueMicrotask(() => {
6565
if (!props.enabled()) return
66-
if (changedStructure) {
67-
updateOwner(owner, rootId)
66+
if (changed_structure) {
67+
let owner_to_update = getClosestIncludedOwner(owner, treeWalkerMode) ?? owner
68+
updateOwner(owner_to_update, root_id)
6869
}
6970
let id = getSdtId(owner, ObjectType.Owner)
7071
props.onNodeUpdate(id)

packages/debugger/src/structure/walker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ const findComponent = <TEl extends object>(
214214

215215
export
216216
type ComputationUpdateHandler = (
217-
rootId: NodeID,
218-
owner: Solid.Owner,
219-
changedStructure: boolean,
217+
rootId: NodeID,
218+
owner: Solid.Owner,
219+
changed_structure: boolean,
220220
) => void
221221

222222
export
@@ -244,7 +244,7 @@ function observeComputation<TEl extends object>(
244244
// copy values in case config gets mutated
245245
let {rootId, onUpdate: onComputationUpdate, mode} = config
246246

247-
const handler = () => {
247+
let handler = () => {
248248
let is_leaf = !comp.owned || comp.owned.length === 0
249249
let changed_structure = was_leaf !== is_leaf || !is_leaf || mode === TreeWalkerMode.DOM
250250
was_leaf = is_leaf

0 commit comments

Comments
 (0)