You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying to implement Realm DB in a React Native app that needs to seed data on the first load. This callback seems like the best way to do it, but I was not able to make it work in my production app and in a simple repro.
This issue seems to be present in the latest available version of realm-js (12.3.1), @realm/react (0.11), and react-native (0.76) with New Architecture enabled.
My production app is still on react-native 0.74 using old architecture, realm-js 12.11.1, and @realm/react (0.8.0) and issue seems to be present there too.
Callback is not triggered for encrypted databases too.
Last year there was a similar issue opened, but no repro was provided: #6143
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
Create new React Native app
Install Realm
Setup Realm provider and basic schema
Add onFirstOpen callback and create data that is needed for created schema
Build and install app
Run it and verify that data is not seeded correctly
I managed to seed database by using realmRef, checking whether db is empty and running seeding script, but not sure whether there are any edge cases to be aware in this case.
How frequently does the bug occur?
Always
Description
Realm documentation mentions optional
onFirstOpen
callback that can be used to seed database with data if necessary.https://www.mongodb.com/docs/realm-sdks/js/latest/types/BaseConfiguration.html
I'm currently trying to implement Realm DB in a React Native app that needs to seed data on the first load. This callback seems like the best way to do it, but I was not able to make it work in my production app and in a simple repro.
This issue seems to be present in the latest available version of
realm-js
(12.3.1),@realm/react
(0.11), andreact-native
(0.76) with New Architecture enabled.My production app is still on
react-native
0.74 using old architecture,realm-js
12.11.1, and@realm/react
(0.8.0) and issue seems to be present there too.Callback is not triggered for encrypted databases too.
Last year there was a similar issue opened, but no repro was provided:
#6143
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
onFirstOpen
callback and create data that is needed for created schemaRepository with reproduction:
https://github.com/purpleCapibara/realm-onFirstLoad-repro/blob/main/App.tsx
Version
"@realm/react": "^0.11.0", "react": "18.3.1", "react-native": "0.76.0", "realm": "^12.13.1"
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Android 15 & iOS 18
Build environment
Output from
npx react-native info
:Logs
Cocoapods version
1.15.2
The text was updated successfully, but these errors were encountered: