-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
When I tried using @tanstack/db in a React Native (Expo) project, I discovered one issue and one potential issue.
@tanstack/storesays in the docs (https://tanstack.com/store/latest/docs/installation) it doesn't support React Native. I thought I saw this mentioned in the Discord but didn't have time to follow-up and couldn't find that thread.
- I haven't actually "run into" this problem yet, so can't confirm or deny.
- @KyleAMathews mentioned on Discord that
@tanstack/dbwill no longer use@tanstack/storefairly soon, so this might be a non-issue in a coming release.
- The
d2tspackage makes use ofFinalizationRegistry, which doesn't seem to be supported by React Native yet (see Support FinalizationRegistry in Hermes facebook/hermes#1440).
- This is the actual error I get when trying a minimal usage of TanstackDB, "ReferenceError: Property 'FinalizationRegistry' doesn't exist, js engine: hermes".
- There's a reply in that issue (Support FinalizationRegistry in Hermes facebook/hermes#1440 (comment)) saying
FinalizationRegistrycan be simulated usingWeakRef, which is supported on RN. - @samwillis mentioned on Discord that
FinalizationRegistryis used as an optimization. In the near-term it might be possible to simply disable the optimization when running in RN. Longer-term maybe it's possible to implement a RN friendly optimization, e.g. using WeakRef as mentioned above.
Minimal example here: https://github.com/bsluther/tanstack-db-test
Versions used when I tried this:
"@tanstack/db": "^0.0.5",
"@tanstack/db-collections": "^0.0.7",
"@tanstack/react-db": "^0.0.5",
"expo": "~53.0.11",
"react": "19.0.0",
"react-native": "0.79.3"
Thorlon1
Metadata
Metadata
Assignees
Labels
No labels