Skip to content

v0.1.8

Pre-release
Pre-release

Choose a tag to compare

@icevelez icevelez released this 24 Jun 08:22
· 146 commits to master since this release

UPDATE

  • Fixed a bug where the data bindings becomes out of sync caused by data binding that needs to replace a placeholder <template></template> with more than one node

Example scenario

<div>
    <template></template>
    <p> {{ message }}</p>
</div>
const processes = [
  // process that replaces <template> with <h1>hello</h1><h2>sub</h2> ,
  // process that text interpolation the word "loading" to <p> 
]

see that example above, if we run the first process the template changes to

<div>
    <h1>hello</h1>
    <h2>sub</h2> <!-- replacing template with more than one node makes the process child node index out of sync -->
    <p> {{ message }}</p>
</div>

and continuing the second process

<div>
    <h1>hello</h1>
    <h2> Loading </h2> <!-- mismatch data binding -->
    <p> {{ message }}</p>
</div>

to fix this, we defer all template replace process to the end of the array to keep the process node index in sync. Like the example below

image

text interpolating first

<div>
    <template></template>
    <p> Loading </p>
</div>

then replacing block last

<div>
    <h1>hello</h1>
    <h2>sub</h2>
    <p> Loading </p>
</div>