@liveblocks/react 0.15.11-test.1 → 0.15.11
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.
- package/README.md +13 -3
- package/lib/esm/index.js +4 -10
- package/lib/esm/index.mjs +4 -10
- package/lib/index.js +7 -25
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://liveblocks.io">
|
|
3
|
-
<img src="https://
|
|
3
|
+
<img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header.svg" alt="Liveblocks" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# `@liveblocks/react`
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://npmjs.org/package/@liveblocks/react">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/@liveblocks/react?style=flat&label=npm&color=c33" alt="NPM" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://bundlephobia.com/package/@liveblocks/react">
|
|
14
|
+
<img src="https://img.shields.io/bundlephobia/minzip/@liveblocks/react?style=flat&label=size&color=09f" alt="Size" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/liveblocks/liveblocks/blob/main/LICENSE">
|
|
17
|
+
<img src="https://img.shields.io/github/license/liveblocks/liveblocks?style=flat&label=license&color=f80" alt="License" />
|
|
18
|
+
</a>
|
|
19
|
+
</p>
|
|
10
20
|
|
|
11
21
|
## Installation
|
|
12
22
|
|
package/lib/esm/index.js
CHANGED
|
@@ -60,12 +60,9 @@ function useRoom() {
|
|
|
60
60
|
function useMyPresence() {
|
|
61
61
|
const room = useRoom();
|
|
62
62
|
const presence = room.getPresence();
|
|
63
|
-
const
|
|
63
|
+
const rerender = useRerender();
|
|
64
64
|
React.useEffect(() => {
|
|
65
|
-
|
|
66
|
-
update((x) => x + 1);
|
|
67
|
-
}
|
|
68
|
-
const unsubscribe = room.subscribe("my-presence", onMyPresenceChange);
|
|
65
|
+
const unsubscribe = room.subscribe("my-presence", rerender);
|
|
69
66
|
return () => {
|
|
70
67
|
unsubscribe();
|
|
71
68
|
};
|
|
@@ -81,12 +78,9 @@ function useUpdateMyPresence() {
|
|
|
81
78
|
}
|
|
82
79
|
function useOthers() {
|
|
83
80
|
const room = useRoom();
|
|
84
|
-
const
|
|
81
|
+
const rerender = useRerender();
|
|
85
82
|
React.useEffect(() => {
|
|
86
|
-
|
|
87
|
-
update((x) => x + 1);
|
|
88
|
-
}
|
|
89
|
-
const unsubscribe = room.subscribe("others", onOthersChange);
|
|
83
|
+
const unsubscribe = room.subscribe("others", rerender);
|
|
90
84
|
return () => {
|
|
91
85
|
unsubscribe();
|
|
92
86
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -60,12 +60,9 @@ function useRoom() {
|
|
|
60
60
|
function useMyPresence() {
|
|
61
61
|
const room = useRoom();
|
|
62
62
|
const presence = room.getPresence();
|
|
63
|
-
const
|
|
63
|
+
const rerender = useRerender();
|
|
64
64
|
React.useEffect(() => {
|
|
65
|
-
|
|
66
|
-
update((x) => x + 1);
|
|
67
|
-
}
|
|
68
|
-
const unsubscribe = room.subscribe("my-presence", onMyPresenceChange);
|
|
65
|
+
const unsubscribe = room.subscribe("my-presence", rerender);
|
|
69
66
|
return () => {
|
|
70
67
|
unsubscribe();
|
|
71
68
|
};
|
|
@@ -81,12 +78,9 @@ function useUpdateMyPresence() {
|
|
|
81
78
|
}
|
|
82
79
|
function useOthers() {
|
|
83
80
|
const room = useRoom();
|
|
84
|
-
const
|
|
81
|
+
const rerender = useRerender();
|
|
85
82
|
React.useEffect(() => {
|
|
86
|
-
|
|
87
|
-
update((x) => x + 1);
|
|
88
|
-
}
|
|
89
|
-
const unsubscribe = room.subscribe("others", onOthersChange);
|
|
83
|
+
const unsubscribe = room.subscribe("others", rerender);
|
|
90
84
|
return () => {
|
|
91
85
|
unsubscribe();
|
|
92
86
|
};
|
package/lib/index.js
CHANGED
|
@@ -131,18 +131,9 @@ function useRoom() {
|
|
|
131
131
|
function useMyPresence() {
|
|
132
132
|
var room = useRoom();
|
|
133
133
|
var presence = room.getPresence();
|
|
134
|
-
|
|
135
|
-
var _React$useState = React__namespace.useState(0),
|
|
136
|
-
update = _React$useState[1];
|
|
137
|
-
|
|
134
|
+
var rerender = useRerender();
|
|
138
135
|
React__namespace.useEffect(function () {
|
|
139
|
-
|
|
140
|
-
update(function (x) {
|
|
141
|
-
return x + 1;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
var unsubscribe = room.subscribe("my-presence", onMyPresenceChange);
|
|
136
|
+
var unsubscribe = room.subscribe("my-presence", rerender);
|
|
146
137
|
return function () {
|
|
147
138
|
unsubscribe();
|
|
148
139
|
};
|
|
@@ -160,18 +151,9 @@ function useUpdateMyPresence() {
|
|
|
160
151
|
}
|
|
161
152
|
function useOthers() {
|
|
162
153
|
var room = useRoom();
|
|
163
|
-
|
|
164
|
-
var _React$useState2 = React__namespace.useState(0),
|
|
165
|
-
update = _React$useState2[1];
|
|
166
|
-
|
|
154
|
+
var rerender = useRerender();
|
|
167
155
|
React__namespace.useEffect(function () {
|
|
168
|
-
|
|
169
|
-
update(function (x) {
|
|
170
|
-
return x + 1;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
var unsubscribe = room.subscribe("others", onOthersChange);
|
|
156
|
+
var unsubscribe = room.subscribe("others", rerender);
|
|
175
157
|
return function () {
|
|
176
158
|
unsubscribe();
|
|
177
159
|
};
|
|
@@ -240,9 +222,9 @@ function useSelf() {
|
|
|
240
222
|
function useStorage() {
|
|
241
223
|
var room = useRoom();
|
|
242
224
|
|
|
243
|
-
var _React$
|
|
244
|
-
root = _React$
|
|
245
|
-
setState = _React$
|
|
225
|
+
var _React$useState = React__namespace.useState(null),
|
|
226
|
+
root = _React$useState[0],
|
|
227
|
+
setState = _React$useState[1];
|
|
246
228
|
|
|
247
229
|
React__namespace.useEffect(function () {
|
|
248
230
|
var didCancel = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/react",
|
|
3
|
-
"version": "0.15.11
|
|
3
|
+
"version": "0.15.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@liveblocks/client": "0.15.11
|
|
37
|
-
"react": "^16.14.0 || ^17"
|
|
36
|
+
"@liveblocks/client": "0.15.11",
|
|
37
|
+
"react": "^16.14.0 || ^17 || ^18"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@babel/core": "^7.12.16",
|