reka.js icon indicating copy to clipboard operation
reka.js copied to clipboard

Cache props evaluation

Open prevwong opened this issue 2 years ago • 0 comments

The evaluator has caching points to prevent unnecessary re-evaluation.

However, when any descendant of a TagTemplate gets re-evaluated; it will cause all of its ancestor TagTemplate to re-evaluate its props unnecessarily.

val global = 0;

component App() => (
   <div color={global + 1}> // props of the parent gets re-evaluated if there's any change to any of it's descendant
      <div> 
         <text value={"Hello"} /> // if this tag changes, all of its parent's props will be re-evaluated
      </div>
   </div>
)

prevwong avatar Dec 25 '23 16:12 prevwong