-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Svelte 5 : important recent regression with DexieJs LiveQuery that stopped working #12341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I tried to check, and the issue appears between next.173 (working) and next.174 (not working), and persists at least until the last version next.175. |
Maybe related to #12330. |
Hum… So next.173 is actually working for this specific example, so it seems something broke from 173 to 174. To be honest, in my actual app I also couldn't use 173 because of a mysterious error:
so I finally use 172 that seems to work fine for now. |
Do you use stores? I'm looking through the changes between 173-174 [email protected]@5.0.0-next.174 |
In my whole code I do use stores when I got the |
Can you try using the latest version please? |
Is it already published? I can only upgrade to 175 to test on my MWE https://github.com/tobiasBora/debugLiveQuery |
Maybe it has to do with the fact that we need to call From the Dexie's docs: import { liveQuery } from "dexie";
import { db } from './db';
const friendsObservable = liveQuery (
() => db.friends
.where('age')
.between(50, 75)
.toArray()
);
// Subscribe
const subscription = friendsObservable.subscribe({
next: result => console.log("Got result:", JSON.stringify(result)),
error: error => console.error(error)
});
// Unsubscribe
subscription.unsubscribe(); You could create a wrapper around liveQuery that creates a readable store (and should work for both Svelte 4 & 5): import { liveQuery } from 'dexie';
import { readable, type Readable } from 'svelte/store';
export function useQuery<T>(querier: () => T | Promise<T>): Readable<T> {
return readable<T>(undefined, (set) => {
return liveQuery(querier).subscribe(set).unsubscribe;
})
} I don't know why it worked before without doing this though. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I recently tried to upgrade my svelte 5 installation (it used to work fine with a previous version of svelte 5), and now I'm basically unable to use Dexie.js as
liveQuery
just outputs an undefined value if I refresh the page, until I write to the database. This happens even on trivial repositories (I just copied the quickstart of Dexie.js). Since an image is worth a thousand words:Reproduction
Clone https://github.com/tobiasBora/debugLiveQuery, start with
npm run dev -- --open
, add a new friend, refresh the page: the friend should be gone. Then add another friend: both the new friend and the old friend should appear.Logs
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: