(
comp: Solid.Computation,
owner_to_update: Solid.Owner,
config: TreeWalkerConfig<TEl>,
)
| 231 | const $WALKER = Symbol('tree-walker') |
| 232 | |
| 233 | function observeComputation<TEl extends object>( |
| 234 | comp: Solid.Computation, |
| 235 | owner_to_update: Solid.Owner, |
| 236 | config: TreeWalkerConfig<TEl>, |
| 237 | ): void { |
| 238 | |
| 239 | // leaf nodes (ones that don't have children) don't have to cause a structure update |
| 240 | // Unless the walker is in DOM mode, then we need to observe all computations |
| 241 | // This is because DOM can change without the owner structure changing |
| 242 | let was_leaf = !comp.owned || comp.owned.length === 0 |
| 243 | |
| 244 | // copy values in case config gets mutated |
| 245 | let {rootId, onUpdate: onComputationUpdate, mode} = config |
| 246 | |
| 247 | let handler = () => { |
| 248 | let is_leaf = !comp.owned || comp.owned.length === 0 |
| 249 | let changed_structure = was_leaf !== is_leaf || !is_leaf || mode === TreeWalkerMode.DOM |
| 250 | was_leaf = is_leaf |
| 251 | onComputationUpdate(rootId, owner_to_update, changed_structure) |
| 252 | } |
| 253 | |
| 254 | observeComputationUpdate(comp, handler, $WALKER) |
| 255 | } |
| 256 | |
| 257 | function resolveElements<TEl extends object>( |
| 258 | value: unknown, eli: ElementInterface<TEl>, list: TEl[] = [] |
no test coverage detected
searching dependent graphs…