@liveblocks/zustand 0.17.11 → 0.18.0-beta2

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 +1 @@
1
- cee9f7e7c838f96a08436ef427e52a81b3c66977
1
+ bc73f8c00db8f6497facfd2eb241de9a54d33faf
package/index.d.ts CHANGED
@@ -25,7 +25,7 @@ declare type LiveblocksState<TState extends ZustandState, TPresence extends Json
25
25
  /**
26
26
  * Other users in the room. Empty no room is currently synced
27
27
  */
28
- readonly others: Array<User<TPresence, TUserMeta>>;
28
+ readonly others: readonly User<TPresence, TUserMeta>[];
29
29
  /**
30
30
  * Whether or not the room storage is currently loading
31
31
  */
package/index.js CHANGED
@@ -113,7 +113,7 @@ function middleware(config, options) {
113
113
  if (storageRoot) {
114
114
  return;
115
115
  }
116
- room = client.enter(roomId);
116
+ room = client.enter(roomId, { initialPresence: {} });
117
117
  updateZustandLiveblocksState(set, {
118
118
  isStorageLoading: true,
119
119
  room
@@ -121,19 +121,19 @@ function middleware(config, options) {
121
121
  const state = get();
122
122
  broadcastInitialPresence(room, state, presenceMapping);
123
123
  unsubscribeCallbacks.push(
124
- room.subscribe("others", (others) => {
124
+ room.events.others.subscribe(({ others }) => {
125
125
  updateZustandLiveblocksState(set, { others: others.toArray() });
126
126
  })
127
127
  );
128
128
  unsubscribeCallbacks.push(
129
- room.subscribe("connection", () => {
129
+ room.events.connection.subscribe(() => {
130
130
  updateZustandLiveblocksState(set, {
131
131
  connection: room.getConnectionState()
132
132
  });
133
133
  })
134
134
  );
135
135
  unsubscribeCallbacks.push(
136
- room.subscribe("my-presence", () => {
136
+ room.events.me.subscribe(() => {
137
137
  if (isPatching === false) {
138
138
  set(
139
139
  patchPresenceState(room.getPresence(), presenceMapping)
@@ -203,7 +203,7 @@ function patchState(state, updates, mapping) {
203
203
  for (const key in mapping) {
204
204
  partialState[key] = state[key];
205
205
  }
206
- const patched = _internal.patchImmutableObject.call(void 0, partialState, updates);
206
+ const patched = _internal.legacy_patchImmutableObject.call(void 0, partialState, updates);
207
207
  const result = {};
208
208
  for (const key in mapping) {
209
209
  result[key] = patched[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/zustand",
3
- "version": "0.17.11",
3
+ "version": "0.18.0-beta2",
4
4
  "description": "A middleware to integrate Liveblocks into Zustand stores.",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -27,7 +27,7 @@
27
27
  "directory": "packages/liveblocks-zustand"
28
28
  },
29
29
  "peerDependencies": {
30
- "@liveblocks/client": "0.17.11",
30
+ "@liveblocks/client": "0.18.0-beta2",
31
31
  "zustand": "^3"
32
32
  },
33
33
  "sideEffects": false