@liveblocks/react 2.17.0-usrnotsettings2 → 2.17.0-usrnotsettings3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  var PKG_NAME = "@liveblocks/react";
3
- var PKG_VERSION = "2.17.0-usrnotsettings2";
3
+ var PKG_VERSION = "2.17.0-usrnotsettings3";
4
4
  var PKG_FORMAT = "esm";
5
5
 
6
6
  // src/ClientSideSuspense.tsx
@@ -20,4 +20,4 @@ export {
20
20
  PKG_FORMAT,
21
21
  ClientSideSuspense
22
22
  };
23
- //# sourceMappingURL=chunk-D5P6PENM.mjs.map
23
+ //# sourceMappingURL=chunk-L7XOVOE2.mjs.map
@@ -98,6 +98,9 @@ function useSignal(signal, selector, isEqual) {
98
98
  }
99
99
 
100
100
  // src/liveblocks.tsx
101
+ import {
102
+ HttpError
103
+ } from "@liveblocks/core";
101
104
  import {
102
105
  assert,
103
106
  createClient,
@@ -2072,8 +2075,22 @@ function useUpdateNotificationSettings_withClient(client) {
2072
2075
  optimisticUpdateId
2073
2076
  );
2074
2077
  },
2075
- () => {
2078
+ (err) => {
2076
2079
  store.optimisticUpdates.remove(optimisticUpdateId);
2080
+ if (err instanceof HttpError) {
2081
+ if (err.status === 422) {
2082
+ const msg = [err.details?.error, err.details?.reason].filter(Boolean).join("\n");
2083
+ console.error(msg);
2084
+ }
2085
+ client[kInternal2].emitError(
2086
+ {
2087
+ type: "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR"
2088
+ },
2089
+ err
2090
+ );
2091
+ } else {
2092
+ throw err;
2093
+ }
2077
2094
  }
2078
2095
  );
2079
2096
  },
@@ -2093,21 +2110,21 @@ function useNotificationSettings_withClient(client) {
2093
2110
  poller.dec();
2094
2111
  };
2095
2112
  }, [poller]);
2096
- const settings = useSignal(store.outputs.userNotificationSettings.signal);
2113
+ const result = useSignal(store.outputs.userNotificationSettings.signal);
2097
2114
  return useMemo2(() => {
2098
- return [settings, updateNotificationSettings];
2099
- }, [settings, updateNotificationSettings]);
2115
+ return [result, updateNotificationSettings];
2116
+ }, [result, updateNotificationSettings]);
2100
2117
  }
2101
2118
  function useNotificationSettingsSuspense_withClient(client) {
2102
2119
  ensureNotServerSide();
2103
2120
  const store = getLiveblocksExtrasForClient(client).store;
2104
2121
  use(store.outputs.userNotificationSettings.waitUntilLoaded());
2105
- const [settings, updateNotificationSettings] = useNotificationSettings_withClient(client);
2106
- assert(!settings.error, "Did not expect error");
2107
- assert(!settings.isLoading, "Did not expect loading");
2122
+ const [result, updateNotificationSettings] = useNotificationSettings_withClient(client);
2123
+ assert(!result.error, "Did not expect error");
2124
+ assert(!result.isLoading, "Did not expect loading");
2108
2125
  return useMemo2(() => {
2109
- return [settings, updateNotificationSettings];
2110
- }, [settings, updateNotificationSettings]);
2126
+ return [result, updateNotificationSettings];
2127
+ }, [result, updateNotificationSettings]);
2111
2128
  }
2112
2129
  function useUser_withClient(client, userId) {
2113
2130
  const usersStore = client[kInternal2].usersStore;
@@ -2459,7 +2476,7 @@ import {
2459
2476
  createThreadId,
2460
2477
  DefaultMap as DefaultMap2,
2461
2478
  errorIf,
2462
- HttpError,
2479
+ HttpError as HttpError2,
2463
2480
  kInternal as kInternal3,
2464
2481
  makePoller as makePoller2,
2465
2482
  ServerMsgCode
@@ -2576,7 +2593,7 @@ function makeRoomExtrasForClient(client) {
2576
2593
  const store = getUmbrellaStoreForClient(client);
2577
2594
  function onMutationFailure(optimisticId, context, innerError) {
2578
2595
  store.optimisticUpdates.remove(optimisticId);
2579
- if (innerError instanceof HttpError) {
2596
+ if (innerError instanceof HttpError2) {
2580
2597
  if (innerError.status === 403) {
2581
2598
  const detailedMessage = [
2582
2599
  innerError.message,
@@ -4116,4 +4133,4 @@ export {
4116
4133
  _useStorageRoot,
4117
4134
  _useUpdateMyPresence
4118
4135
  };
4119
- //# sourceMappingURL=chunk-X2FQ2FNK.mjs.map
4136
+ //# sourceMappingURL=chunk-M2B54KRP.mjs.map