drizzle-team / drizzle-team/drizzle-orm
[BUG]: drizzle-orm/expo-sqlite API is not real async. Always block UI thread.
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.44.7
### What version of `drizzle-kit` are you using?
0.31.7
### Other packages
_No response_
### Describe the Bug
Example code:
```js
export async function getRows(words: string[]): Promise {
if (!words || words.length === 0) return []
return await dictDB.query.tableDictWords.findMany({
columns: {
id: true,
word: true,
lemma: true,
isLemma: true,
type: true,
classes: true,
ipa: true,
rank: true,
},
where: inArray(tableDictWords.id, words),
})
}
```
- This code is async. Even drizzle typescript is async. But the code is executed synchronously.
- This code always block UI thread
- For heavy DB query => block UI thread for 1 seconds.
- I always add `await delay(0)` to all db query function for UI show immediately
- Promise.resolve(1000000 forloop) is not a real async task. It will block UI thread. So i add await delay(0)
- I think Drizzle is using sync API in expo-sqlite.
Contributor guide
Assessment
This issue has not been assessed yet.