v0.17.8 New history APIs ↩️ ↪️
-
In @liveblocks/client:
- Add
canUndo()andcanRedo()utilities toroom.history - Add
"history"event type toroom.subscribe()to subscribe to the current user's history changes
- Add
-
In @liveblocks/react:
- Add
useCanUndo()anduseCanRedo()hooks
- Add
-
v0.17.7 -
In @liveblocks/zustand:
- Simplify zustand middleware integration with Typescript.
TPresence,TStorage,TUserMeta, andTRoomEventare now optional.
- Simplify zustand middleware integration with Typescript.
Note that
@liveblocks/zustanddoes not work with zustand > v4 because v3 and v4 have completely different type definitions. As soon as zustand v4 is out of the RC phase, we will consider updating our middleware to work with the latest version.Let's take a look at our To-do list example. Without our middleware, the store would look like this:
With our middleware, you simply need to move the
Stateparam at the middleware level:If you want to type
otherspresence, you can use theTPresencegeneric argument on the middleware.-
v0.17.6 -
In @liveblocks/react:
- Expose
RoomContextin the return value ofcreateRoomContext()
- Expose
-
v0.17.5 -
In @liveblocks/react:
- Fix bug where changing the
keyargument ofuseMap(),useList(),useObject()did not resubscribe to updates correctly - Ignore changes to the
RoomProvider's initial presence/storage props on subsequent renders. This makes it behave closer touseState(initialState)
- Fix bug where changing the
-
v0.17.4 Fix missing documentation for hooks created via
createRoomContext().v0.17.1 Fix
@liveblocks/nodespackaging.v0.17.0 For information, please read our Upgrade Guide.
TypeScript improvements ✨
This release contains major TypeScript improvements. The recommended setup now is that you define your own Presence and Storage types at the highest level (i.e. where you set up the room). After that initial one-time setup, you will no longer need to provide any extra type annotations anywhere for your Liveblocks code! 🙌
To learn how to set that up, follow the instructions in our Upgrade Guide.
- No more
anytypes used (in@liveblocks/clientand@liveblocks/react) - All APIs that work with Presence data will now require it to be JSON-serializable
- All APIs that work with Storage data will now require it to be LSON (= JSON + Live structures)
- All Live structures now take mandatory type params for their payloads, just
like the built-in array, object, and map types do:
LiveMap<K, V>(likeMap<K, V>)LiveObject<{ a: number, b: string }>(like, for example,{ a: number, b: string })LiveList<T>(likeArray<T>)
React Native support ✨
We now support React Native! To learn how to use Liveblocks in your React Native projects, see our API reference. It's surprisingly simple!
New APIs ✨
-
In @liveblocks/react:
createRoomContext()is now the preferred way to initialize hooks.
-
In the API:
- New endpoint to Get Users in a Room
- New endpoint to Get a list of all Rooms
Bug fixes 🐛
- Improved conflict resolution on LiveList
- Various minor internal bug fixes
Breaking changes
-
In @liveblocks/client:
- Removed old
Room.unsubscribe()API
- Removed old
New deprecations
-
In @liveblocks/client:
- The
defaultPresenceoption toclient.enter()will get renamed toinitialPresence - The
defaultStorageRootoption toclient.enter()will get renamed toinitialStorage - Calling
new LiveMap(null)will stop working. Please usenew LiveMap(), ornew LiveMap([])
- The
-
In @liveblocks/react:
- Importing the React hooks directly is deprecated, instead use the new
createRoomContext()helper. For help, read the Recommended Upgrade Steps section within our Upgrade Guide - The second argument to
useList(),useObject(), anduseMap()is deprecated - The RoomProvider's
defaultPresenceis renamed toinitialPresence - The RoomProvider's
defaultStorageRootis renamed toinitialStorage
- Importing the React hooks directly is deprecated, instead use the new
- No more
v0.16.17 Fix bug in internal code where some legal authentication tokens would be considered invalid.
v0.16.16 Internals only.
v0.16.15 Internals only.