Closed Techn1x closed 1 year ago
The motivation here is I have other tracked functions down the line in child components that use data from the book record to then go and request further book metadata records.
So when it re-renders with the old book (instead of going to isPending), it goes and triggers the child component's tracked functions for the old metadata requests again.
(I've made sure to exclude this as the cause from my testing though by completely removing the child component)
@NullVoxPopuli do you know if this is expected behaviour or a bug?
Or is this more of an issue with the underlying ember-async-data library? I can file there instead if you like https://github.com/tracked-tools/ember-async-data
Sorry i forgot to look at this! There's for the ping! I'll investigate tomorrow
Found it was an issue with how trackedFunction
is managing state -- fix here: https://github.com/NullVoxPopuli/ember-resources/pull/1011/files#r1346291970
I've been playing around with trackedFunction and it works great but I have noticed some odd behaviour.
I have a trackedFunction like this;
and a template like this;
On initial load with bookId 33, I get the output
So far so good, but when the QP changes (say, to bookId 27), I get this output;
It seems to re-render with the old state & value before flipping into isPending. Is this expected behaviour? ~Is it specific to ember-data? (running 4.12.3)~ EDIT: further testing has shown this occurs for other async requests as well, not just ember-data.