- None
- Add flag to keep realm open on unmount of
RealmProvider
. (#6023)
- <How to hit and notice issue? what was the impact?> (#????, since v?.?.?)
- None
- Realm >= 11.0.0
- Added more documentation to provider params.
- Fixed using
@realm/react
in jest tests, by providing a common js distribution. (#6049
- React Native >= v0.71.4
- Realm Studio v14.0.0.
- File format: generates Realms with format v23 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).
- Include the
src
in the distributed package. This fixes a warning about source maps being not included. - Get the
useAuth
anduseEmailPasswordAuth
tsdoc to appear on hover over for LSP enabled IDEs. useEmailPasswordAuth
was crashing on v11 since there are no named exports onRealm
.
- Refactor
useAuthOperation
to use thereject
callback rather thancatch
. - Refactor
useAuthOperation
to not return a result. All methods arevoid
.
-
Add authentication hooks,
useAuth
anduseEmailPasswordAuth
Usage example -
Allow
useQuery
to be passed aquery
function wheresorted
andfiltered
methods can be called (#5471) Thanks for the contribution @levipro!Example:
const SomeComponent = () => { const user = useUser(); const items = useQuery(Item, (res) => res.filtered(`owner_id == "${user?.id}"`).sorted('createdAt'), [user] ); };
-
Create a default context so the
RealmProvider
,useQuery
,useRealm
, anduseObject
can be directly imported from@realm/react
(#5292)Example:
// These imports are now available without calling `createRealmContext` import {RealmProvider, useQuery} from '@realm/react' //... // Provider your schema models directly to the realm provider <RealmProvider schema={[Item]}> <SomeComponent/> </RealmProvider> const SomeComponent = () => { const items = useQuery(Item) //... }
NOTE: If your app is using multiple Realms, then you should continue using
createRealmContext
useUser
is now typed to never returnednull
#4973 Example:const user = useUser(); // before console.log(user?.id); // Optional chaining required // now console.log(user.id); // No typing error
- React Native >= v0.70.0
- Atlas App Services.
- Realm Studio v13.0.0.
- File format: generates Realms with format v23 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).
- Improve AppProvider and UserProvider rendering performance (#5215)
- Stabilized references for Collections, Lists and Objects (#5269)
- Immediately bind local Realm in the RealmProvider (#5074)
- Prime any list properties with an cachedCollection so that updates fire correctly (#5185)
- Primary Keys as non-primative values would reset the cached objects, since their reference always changes
- Create a listener on the collection if the object doesn't exist, and rerender when it is created (#4514)
- File format: generates Realms with format v22 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).
- Fix crash when using
useObject
with a model containing aList
of primitives (#5058) - Fix potential infinite rerender issue when using
useUser
and theUserProvider
(#4967)
- Added a contribution guide to assist in contributions from the community.
- Update devDependencies for testing:
- react v18.1.0
- react-native v0.70.1
- react-test-renderer v18.1.0
- @testing-library/react-native v11.2.0
- @testing-library/jest-native v4.0.13
- Refactor tests to use updated
testing-library
- Fix realm collection and object typing to reflect changes to Class Based Models introduced in Realm
11.0.0
(#4905)
- Upgrade dev dependency of React Native to 0.70.0 and any relevant packages effected by this upgrade
- Migrate tests away from
@testing-library/react-hooks
which is now part of@testing-library/react-native
- Realm >= v0.11.0
- Fix peer dependency for Realm in package.json to support
-rc
branches of Realm (#4621) - Add generic type parameters to
@realm/react
hooks (#4716)
- Add realmRef property to
RealmProvider
to access the configured realm outside of the provider component (#4571)- Additionally appRef on
AppProvider
was added to provide access toRealm.App
from outside the provider component
- Additionally appRef on
- Results from
useQuery
could not be passed toMutableSubscriptionSet.add
/remove
(#4507, since v0.1.0)
- Add UserProvider and useUser hook (#4557). Usage example:
import {AppProvider, UserProvider} from '@realm/react'
//...
// Wrap your RealmProvider with the AppProvider and provide an appId
<AppProvider id={appId}>
<UserProvider fallback={LoginComponent}>
{/* After login, user will be automatically populated in realm configuration */}
<RealmProvider sync={{flexible: true}}>
//...
</RealmProvider>
</UserProvider>
</AppProvider>
// Access the app instance using the useApp hook
import {useUser} from '@realm/react'
const SomeComponent = () => {
const user = useUser()
//...
}
- Add AppProvider and useApp hook (#4470). Usage example:
import {AppProvider} from '@realm/react'
//...
// Wrap your RealmProvider with the AppProvider and provide an appId
<AppProvider id={appId}>
<RealmProvider sync={{user, flexible: true}}>
//...
</RealmProvider>
</AppProvider>
// Access the app instance using the useApp hook
import {useApp} from '@realm/react'
const SomeComponent = () => {
const app = useApp()
//...
}
- Implicit children was removed from
React.FC
. Children has now been explicitly added to provider props. (#4565) - Fixed potential "Cannot create asynchronous query while in a write transaction" error with
useObject
due to adding event listeners while in a write transaction (#4375, since v0.1.0)
- None.
- Tests run with
--forceExit
to prevent them hanging (#4531)
- Allow
createRealmContext
to be called without an initial configuration - Add a
fallback
property toRealmProvider
that is shown while realm is opening
- Fixed bug when trying to access a collection result with an out of bounds index.(#4416, since v0.2.0)
- None
- None
- Add ability to import
Realm
directly from@realm/react
- Add cachedObject and cachedCollection
- Ensures that React.Memo that have Realm.Object/Collection as a property only rerender on actual changes
- Increased compatability with VirtualizedList/FlatList
- Added more comprehensive documentation in the source code
- List properties of a Realm.Object now rerender on change
- Broadened test coverage for collections, lists and linked objects
- Initial release