5 Matching Annotations
  1. Jan 2022
    1. We cannot make the above statement reactive because we touch tmpCopyAsTemplates.
    2. It works if you always want b to be the value deriving from a. However in the example above, we want the value of b to be temporarily out of sync of a.
    3. For me there is a distinct difference between these two scripts: let a = 1; $: b = a * 2; let a = 1; let b; $: { b = a * 2 }; The first example defines a "recipe" for how to create b and b is completely defined by that declaration. Outside of that it is immutable, data flows only into a single sink. The second example declares a variable b and then uses a reactive statement to update it. But it also allows you to do with b whatever you want. If someone wants to go that route (definitely not me), they are free to do so at their own risk of ensuring consistency.
    4. The intended behavior for the code snippet above is to reactively update b when a changes allows b temporarily go "out-of-sync" of a when calling update, setting b to 42 in this case, b is not always a * 2 however, if a changes again, b will be updated back to a * 2, instead of staying at 42
    1. I don't think these are two different interests in contrast with each other. I wanna update that temporary object and when the dep changes I re-create the temporary object. Simple as that.