Error in $doc.update()?
I'm not quite sure if I'm doing it wrong. The error I'm getting is:
Here's the component
Normally (e.g. in my system, as opposed to this module)
$doc.update()
just works for me. I haven't seen this _id
error before. It seems weird because update
is being called on $doc
, which is a TJSDocument
instance of the actor
, so it has the _id
already I would expect.4 Replies
Ahh.. nvm. The actor is in memory, so I need to use
updateSource()
not update()
You are also using
Timing.debounce
incorrectly.
It should be:
Timing.debounce
is a higher order function that returns a function with the specified debounce functionality around the callback / function specified as the first argument.I ended up with this:
The
$doc = $doc
– is needed to make the mod
value (last line of the template) reactive (from https://learn.svelte.dev/tutorial/updating-arrays-and-objects)
It feels inelegant. Is there a better way to facilitate nested reactivity when using $doc.update()
or $doc.updateSource()
?Presently, no because
$doc.updateSource
doesn't trigger the DB update response / callbacks. However, I'll look into adding an updateSource
method directly to TJSDocument
which will invoke the underlying updateSource
of any wrapped core document, but will also trigger reactivity for in memory changes. In this case you'll drop the $
and it will just be doc.updateSource(...)
. I might also add a correponding update
method to TJSDocument
.
So, in 0.2.0
there should be a way to automatically trigger reactivity w/ TJSDocument for in memory usage.