Upgrading - Upgrading to 2.24

We’ve renamed some of the concepts around notifications and notification settings to improve clarity.

How to upgrade

Upgrade to 2.24 by downloading the latest version of each Liveblocks package you’re using. The easiest way to do this is to run the following command:

$npx create-liveblocks-app@latest --upgrade

Does this affect you?

If you are using notification settings in any way—with @liveblocks/client, @liveblocks/react, @liveblocks/node, or the REST API—continue reading to see the changes. The naming changes are backwards compatible.

Otherwise, no changes will affect you.

Naming changes

Rationale

Historically, we used the term “notification settings” to refer to room-level settings that control the inbox notifications received by a user (e.g. setting "threads" to "all" would make the user receive inbox notifications for any threads activity in the room, not just the ones where they participate).

With 2.18, we introduced the concept of “user notification settings”, which are project-level settings that control the notifications ( "notification" webhook events, not "inbox notifications") received by a user (e.g. setting email.$myCustomNotification to false would disable "notification" webhook events for the $myCustomNotification kind and the email channel).

To improve clarity, we’re renaming these concepts:

  • “room notification settings” → “room subscription settings”: they control which things a user is subscribed to in a room
  • user notification settings” → “notification settings”: they control which notifications a user receives

What changed

All methods, hooks, types, and REST API endpoints that were using these terms have been renamed to use the new naming, see the examples below.

We provide a codemod to automatically update your codebase to the new naming.

$npx @liveblocks/codemod@latest rename-notification-settings

@liveblocks/react

// ❌ Beforeimport {  useRoomNotificationSettings,  useUpdateRoomNotificationSettings,} from "@liveblocks/react";
// ✅ Afterimport { useRoomSubscriptionSettings, useUpdateRoomSubscriptionSettings,} from "@liveblocks/react";
// ❌ BeforeuseErrorListener((error) =>  if (error.context.type === "UPDATE_NOTIFICATION_SETTINGS_ERROR") {    /* ... */  });
// ✅ AfteruseErrorListener((error) => if (error.context.type === "UPDATE_ROOM_SUBSCRIPTION_SETTINGS_ERROR") { /* ... */ });

@liveblocks/client

// ❌ Beforeimport type { RoomNotificationSettings } from "@liveblocks/client";
// ✅ Afterimport type { RoomSubscriptionSettings } from "@liveblocks/client";
// ❌ Beforeconst { room, leave } = client.enterRoom("my-room-id");
room.getNotificationSettings();room.updateNotificationSettings(/* ... */);
// ✅ Afterconst { room, leave } = client.enterRoom("my-room-id");
room.getSubscriptionSettings();room.updateSubscriptionSettings(/* ... */);
// ❌ Beforeimport type { UserNotificationSettings } from "@liveblocks/client";
// ✅ Afterimport type { NotificationSettings } from "@liveblocks/client";

@liveblocks/node

// ❌ Beforeconst liveblocks = new Liveblocks({  secret: "sk_prod_xxxxxxxxxxxxxxxxxxxxxxxx",});
await liveblocks.getRoomNotificationSettings(/* ... */);await liveblocks.updateRoomNotificationSettings(/* ... */);await liveblocks.deleteRoomNotificationSettings(/* ... */);
// ✅ Afterconst liveblocks = new Liveblocks({ secret: "sk_prod_xxxxxxxxxxxxxxxxxxxxxxxx",});
await liveblocks.getRoomSubscriptionSettings(/* ... */);await liveblocks.updateRoomSubscriptionSettings(/* ... */);await liveblocks.deleteRoomSubscriptionSettings(/* ... */);

REST API

# ❌ Beforehttps://api.liveblocks.io/v2/rooms/:roomId/users/:userId/notification-settings
# ✅ Afterhttps://api.liveblocks.io/v2/rooms/:roomId/users/:userId/subscription-settings

That’s it for 2.24!

We use cookies to collect data to improve your experience on our site. Read our Privacy Policy to learn more.