stage0 icon indicating copy to clipboard operation
stage0 copied to clipboard

Collecting references

Open kokujin opened this issue 5 years ago • 4 comments

  <h2>#test</h2>
  <div>
  <h2>Test</h2>
    <h1>#count</h1>
    <button #down>-</button>
    <button #up>+</button>
  </div>

Given the view snippet above, I tried to collect references using

const { count, down, up, board, test } = view.collect(view)

This failed and collection stopped at the first node, "H2". How do I collect all references in a view with different nodes? Thanks

kokujin avatar Apr 14 '19 09:04 kokujin

Yeah, currently, stage0 doesn't support fragments, i.e. >2 root nodes in the template. I'll update you once implemented.

Freak613 avatar Apr 14 '19 21:04 Freak613

any update or even better pointer how to do support for template fragments ?

pokerman79 avatar Jul 03 '19 18:07 pokerman79

@Freak613 any update on this feat?

gkn06 avatar Feb 11 '20 15:02 gkn06

Not yet. The thing that I'm struggling with the most here is that introducing fragments will require proper reconciler support, because once inserted they will lose their context of the link with the siblings, and also will be removed from fragment. Without reconcile, it will leave the library in inconsistent state. And for reconciler, to have it working, the problem require hacks or additional structures for storing relations in the dom nodes or outside of it in the vdom. That's the pro of the vdom approach, that it can keep non-standart things in mind.

Freak613 avatar Feb 12 '20 11:02 Freak613