You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now imagine that we fetch an object that was nested when it arrived. Here's what happens:
!fetches_out[key] returns true, so route is called with fetch and the key
route calls run_handler
run_handler adds the key to pending_fetches in the case of a fetch (line 487).
That key will never be removed from pending_fetches. The only time that keys are removed from pending_fetches is on pub, but pub won't be called for objects that arrived nested on another object.
What it looks like in my application
First, I modified statebus.js's loading_keys function to show which keys a function is waiting on, and whether that key is actually already in cache:
function loading_keys (keys) {
// Do any of these keys have outstanding gets?
// console.log('Loading: pending_keys is', pending_fetches)
for (var i=0; i<keys.length; i++){
if (pending_fetches[keys[i]]) {
console.log("loading_keys: still loading", keys[i], fetch(keys[i]))
return true
}
}
return false
}
Second, I have a reactive function that fetches /strategies. By the time this reactive function is called, /strategies is already in cache because it was nested in a previously fetched object. This reactive function has an @Loading guard.
Here's the console output:
Is that enough info, or do you need a minimal test case?
The text was updated successfully, but these errors were encountered:
Yeah this bug report is too ambiguous. You wrote a lot of stuff, but a good bug report only needs to say:
If you do this
Then this happens
Whereas this is what I expect to happen
You expressed (2) and (3) by saying that your reactive functions don't complete, but I don't know what your loading functions are, so I'm lost on (1).
A test case would help by providing (1) and (2), but it doesn't have to be minimal, and it's not the only way to do it. Making your testcase minimal is like a nice favor to do, because either of us could do that work of localizing the problem once we can reproduce it. But right now I can't reproduce the problem.
pending_fetches isn't updated properly when you fetch an object with nested keyed objects.
Problems this causes
What is happening
Start at line 69 @ https://github.com/invisible-college/statebus/blob/master/statebus.js. There is a comment about counting keys that arrived on a nested object, with a subsequent call to bus.route.
Now imagine that we fetch an object that was nested when it arrived. Here's what happens:
That key will never be removed from pending_fetches. The only time that keys are removed from pending_fetches is on pub, but pub won't be called for objects that arrived nested on another object.
What it looks like in my application
First, I modified statebus.js's loading_keys function to show which keys a function is waiting on, and whether that key is actually already in cache:
Second, I have a reactive function that fetches /strategies. By the time this reactive function is called, /strategies is already in cache because it was nested in a previously fetched object. This reactive function has an @Loading guard.
Here's the console output:
Is that enough info, or do you need a minimal test case?
The text was updated successfully, but these errors were encountered: