While you were at Thanksgiving, we were busy! Here are the new features in Convex 0.6.0:
- React Native
- Mobile Browser Support
- Breaking:
unique
now can returnnull
npx convex import
Improvements- Connection Status Information
Details below.
React Native
It is easier than ever to use React Native with Convex! We have new documentation that explains how to configure Convex for a React Native environment. Additionally, there is a new React Native demo app that you can use to get started.
Mobile Browser Support
The ConvexReactClient
now works better in mobile browsers. This release includes logic to detect when the WebSocket
connection to the Convex backend has died and automatically reconnect. This is important for browsers like Safari on iOS that don’t detect this automatically.
Breaking: unique
now can return null
Previously, calling .unique()
at the end of a database query would throw an exception if no results were found. For example calling
const counter = await db.query("counter").unique();
would throw an exception if there are no documents in the "counter"
table.
Now, .unique()
will return null if no documents are found:
const counterOrNull = await db.query("counter").unique();
We believe this is a better default for the majority of use cases. Often you aren’t sure that a document will exist and should explicitly handle that case. You can still throw an exception if you encounter null
.
npx convex import
Improvements
We’ve made a number of improvements to importing data with npx convex import
:
- You can now import JSON files that contain an array of JSON objects in addition to existing support for JSON lines files with an object on each line.
- No need to specify the file format with
--format
! The CLI will infer your file’s format based on its extension (.csv
,.json
,.jsonl
). - If your table already has data, you can append new documents into it using
--append
or replace the contents with--replace
. - The import size limit has increased to 8192 rows and 8 MiB.
Connection Status Information
The ConvexReactClient
now exposes a connectionState()
method.
This has information on whether there are any inflight mutations or actions within the client. It also describes whether the client has a current connection to the Convex backend.
This information can be useful for exposing connection status information to the user. For example, Convex apps may want to render a banner if the client has been unable to connect to the backend for an extended period of time.