Upgrading - Upgrading to 1.10
Notifications is the first Liveblocks product that works across multiple rooms, and this has required us to introduce breaking changes to ensure a consistent API for Comments and Notifications.
How to upgrade?
You can upgrade to 1.10 by downloading the latest version of each Liveblocks package you’re using, for example in a React app:
All changes are for Comments and Notifications
If you’re not using Comments or Notifications, there are no breaking changes for you! However, if you are using these, or intend to use them in future, keep reading.
Security
Users must see the notifications across multiple rooms when they open their
inbox. This is the first time we must expose an API not associated with a single
room. It forced us to introduce a minor breaking change in our authentication
mechanism. Using
useInboxNotifications
will call your authentication endpoint without a room.
createClient with callback
If you use createClient with authEndpoint
as a callback,
room is now optional.
Comments resolver functions
Notifications needs to resolve users, as well as Comments, so we’ve lifted the
resolver functions from createRoomContext to createClient.
Before:
After:
Because the resolvers are no longer room-based, you’ll notice that roomId is
no longer in the parameters.
Resolver types
Because the resolvers have moved to the client, the ResolveUsersArgs and
ResolveMentionSuggestionsArgs types are now exported from @liveblocks/client
instead of @liveblocks/react.
Relatedly,
stringifyCommentBody’s
CommentBodyResolveUsersArgs no longer exists, and you should use
ResolveUsersArgs instead.
Comments CSS variables
Some elevation and tooltip
CSS variables have been
removed:
--lb-tooltip-background--lb-tooltip-foreground--lb-tooltip-foreground-contrast--lb-elevation-background--lb-elevation-foreground--lb-elevation-foreground-contrast
Because these no longer exist, we recommend using the basic --lb-* variables
directly on .lb-elevation or .lb-tooltip .
Before:
After:
Comments overrides
Comments overrides allows you to replace a string or node in default components, with another that you’ve specified. Some overrides have been changed.
SELFis nowUSER_SELF.UNKNOWN_USERis nowUSER_UNKNOWN.COMMENT_REACTION_REMAININGno longer exists, and you should use theLIST_REMAINING_USERSinstead.COMMENT_REACTION_TOOLTIPis nowCOMMENT_REACTION_LIST, and its arguments have been changed to(list, emoji, count).
Before:
After:
When upgrading, remember that overrides can be applied both globally with
<CommentsConfig>, and per component, e.g. <Composer>. Learn more in the
overrides API reference.