Dexie liveQuery()'s querier callback did'nt await all of its spawned promises. #1839
Replies: 2 comments 4 replies
-
|
Realized this warning was added to dexie 5 days ago to resolve #1831 so I’m wondering if maybe I’ve encountered an edge case. I’m not spawning any promises inside the queries that I’m not awaiting, as far as I can tell. Is the check too aggressive? |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the report! I should probably try solid-dexie and see why it warns on this. Looking at the code you pasted I don't see any un-awaited promise so it might be a false positive. This warning was meant to detect queriers that did things like: someArray.forEach(async () => ....) // Problematic - spawns promises without awaitinginstead of the correctly awaiting everything: await Promise.all(someArray.map(async () => ...)) // correct!or possibly: for (const item of someArray) {
await ... // correct!
}...which could lead to returning unfinished results and also possible performance degradation. I'll try see if I get the same with solid-dexie and find the reason for it. If you have a repro of it, please share! Otherwise I'll just try with solid-dexie and see if I get the same warning. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experimenting with using Dexie with solidjs, using a few dozen lines of code borrowed from https://github.com/faassen/solid-dexie/blob/main/src/solid-dexie.ts. I've encountered what I'm going to guess is a dumb question.
The connecting logic is essentially just hooking up
liveQueryto solidjs's reactivity bindings. It works as designed with simple queries that just proxy straight through to a dexie Table method. But when I try to do something more complicated inside an async querier, I get this warning on the console:So, two things there: One, there's a typo on
did'nt. Two: I can't find any reference to what this means. Who is the culprit? Is it that my querier function isn't awaiting something? Or is it that the borrowed solid-dexie code isn't querying anything? Or is it a bug in dexie (unlikely).I'm using Dexie version
4.0.1-beta.4, and if it's important, it's connected todexie-cloud-addon4.0.1-beta.53.The querier function in question looks like this:
I'm pretty sure the error would manifest with any async querier function.(I tested this assertion and it does not always repro. Still trying to find the connection)I'm connecting it to solid-dexie using:
I'm using a slightly hacked version of the solid-dexie code that looks like this:
I'm pretty confident this is going to be a "dumb question" kinda answer, but I'm not sure where to find it on my own.
Beta Was this translation helpful? Give feedback.
All reactions