3 ms·
Does svelte still have this thing where you need to reassign a variable to itself for updating?
by frodowtf 4y ago
Does svelte still have this thing where you need to reassign a variable to itself for updating?
- myrryr 4y agoUnder very particular conditions, yes. fewer conditions now than it used to be, but you still need to do this at times. Usually I take it as a sign I should move to using a store. Sveltekit is very good.
- sk0g 4y agoNo? External changes to variables trigger reloads too, it was quite a nice experience coming from back end and hobby game dev. Now, the reactive blocks, where an update to _any_ variable used in them trigger the re-evaluation seemed rife for abuse - particularly when the variables could be brought in from other files, but I forget the mechanics behind that. I used it plenty of course. Forgot how it worked the day after I stopped working on the project though. For example, this file https://github.com/sk0g/peripheral-emulator-web-app/blob/master/src/lib/Ultrasonic2D.svelte https://github.com/sk0g/peripheral-emulator-web-app/blob/mas... Edit: unless you mean lines like `ultrasonicDetectedDistance.update(v => v = distance)`, which yeah was an interesting quirk. Not enough of a pain to go with something like React, thought that wouldn't meet the latency requirements for this project. TBF neither did Svelte entirely, but it got close.