drizzle-team / drizzle-team/drizzle-orm

[BUG]: useLiveQuery with expo sqlite won't cause update in react if the query returns no rows

Open
#2,620 9 comments 8 reactions 0 assignees View on GitHub
bug db/sqlite driver/expo-sqlite priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

^0.31.4

### What version of `drizzle-kit` are you using?

^0.22.8

### Describe the Bug

`useLiveQuery(db.select().from(....)` won't cause an update in react if the query returns 0 rows.

### Expected behavior

it should cause an update. If I delete something from my database the UI should reflect it.

### Environment & setup

this expo setup
```json
"drizzle-orm": "^0.31.4",
"expo": "~51.0.17",
"expo-constants": "~16.0.2",
"expo-crypto": "~13.0.2",
"expo-font": "~12.0.7",
"expo-linking": "~6.3.1",
"expo-router": "~3.5.17",
"expo-splash-screen": "~0.27.5",
"expo-sqlite": "^14.0.4",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.6",
"expo-web-browser": "~13.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.74.2",
"react-native-calendars": "^1.1305.0",
"react-native-gesture-handler": "~2.16.1",
"react-native-paper": "^5.12.3",
"react-native-paper-dates": "^0.22.12",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-web": "~0.19.10",
```

```ts
import { openDatabaseSync } from "expo-sqlite";
import { drizzle } from "drizzle-orm/expo-sqlite";
import * as schema from "./schema"

export const exposqlite = openDatabaseSync("mydb", { enableChangeListener: true});
export const db = drizzle(exposqlite,{schema});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.