@pluv/react 0.5.10 → 0.5.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/react@0.5.10 build /home/runner/work/pluv/pluv/packages/react
2
+ > @pluv/react@0.5.11 build /home/runner/work/pluv/pluv/packages/react
3
3
  > tsup src/index.ts --format esm,cjs --dts --external react
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,10 +8,10 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 8.65 KB
12
- ESM ⚡️ Build success in 130ms
13
- CJS dist/index.js 11.11 KB
14
- CJS ⚡️ Build success in 130ms
11
+ ESM dist/index.mjs 8.60 KB
12
+ ESM ⚡️ Build success in 98ms
13
+ CJS dist/index.js 11.07 KB
14
+ CJS ⚡️ Build success in 91ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4787ms
16
+ DTS ⚡️ Build success in 5670ms
17
17
  DTS dist/index.d.ts 4.37 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/react
2
2
 
3
+ ## 0.5.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 2c9c5c3: changed my-presence to be non-nullable
8
+ - Updated dependencies [2c9c5c3]
9
+ - @pluv/client@0.8.1
10
+
3
11
  ## 0.5.10
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ interface CreateRoomBundle<TIO extends IOLike, TPresence extends JsonObject, TSt
37
37
  usePluvConnection: <T extends unknown = WebSocketConnection>(selector: (connection: WebSocketConnection) => T, options?: SubscriptionHookOptions<Id<T>>) => Id<T>;
38
38
  usePluvEvent: <TType extends keyof InferIOOutput<TIO>>(type: TType, callback: (data: Id<IOEventMessage<TIO, TType>>) => void) => void;
39
39
  usePluvMyPresence: <T extends unknown = TPresence>(selector?: (myPresence: TPresence) => T, options?: SubscriptionHookOptions<Id<T> | null>) => [
40
- myPresence: Id<T> | null,
40
+ myPresence: Id<T>,
41
41
  updateMyPresence: Dispatch<UpdateMyPresenceAction<TPresence>>
42
42
  ];
43
43
  usePluvMyself: <T extends unknown = UserInfo<TIO, TPresence>>(selector?: (myself: Id<UserInfo<TIO, TPresence>>) => T, options?: SubscriptionHookOptions<Id<T> | null>) => Id<T> | null;
package/dist/index.js CHANGED
@@ -180,9 +180,7 @@ var createRoomBundle = (client, options = {}) => {
180
180
  );
181
181
  const getSnapshot = room.getMyPresence;
182
182
  const _selector = (0, import_react2.useCallback)(
183
- (snapshot) => {
184
- return !snapshot ? null : selector(snapshot);
185
- },
183
+ (snapshot) => selector(snapshot),
186
184
  [selector]
187
185
  );
188
186
  const myPresence = (0, import_with_selector.useSyncExternalStoreWithSelector)(
package/dist/index.mjs CHANGED
@@ -150,9 +150,7 @@ var createRoomBundle = (client, options = {}) => {
150
150
  );
151
151
  const getSnapshot = room.getMyPresence;
152
152
  const _selector = useCallback2(
153
- (snapshot) => {
154
- return !snapshot ? null : selector(snapshot);
155
- },
153
+ (snapshot) => selector(snapshot),
156
154
  [selector]
157
155
  );
158
156
  const myPresence = useSyncExternalStoreWithSelector(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/react",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "@pluv/client React.js bindings",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "@types/use-sync-external-store": "^0.0.3",
21
21
  "fast-deep-equal": "^3.1.3",
22
22
  "use-sync-external-store": "^1.2.0",
23
- "@pluv/client": "^0.8.0",
23
+ "@pluv/client": "^0.8.1",
24
24
  "@pluv/types": "^0.2.0"
25
25
  },
26
26
  "peerDependencies": {
@@ -106,7 +106,7 @@ export interface CreateRoomBundle<
106
106
  selector?: (myPresence: TPresence) => T,
107
107
  options?: SubscriptionHookOptions<Id<T> | null>
108
108
  ) => [
109
- myPresence: Id<T> | null,
109
+ myPresence: Id<T>,
110
110
  updateMyPresence: Dispatch<UpdateMyPresenceAction<TPresence>>
111
111
  ];
112
112
  usePluvMyself: <T extends unknown = UserInfo<TIO, TPresence>>(
@@ -311,7 +311,7 @@ export const createRoomBundle = <
311
311
  const usePluvMyPresence = <T extends unknown = TPresence>(
312
312
  selector = identity as (myPresence: TPresence) => T,
313
313
  options?: SubscriptionHookOptions<Id<T> | null>
314
- ): [Id<T> | null, Dispatch<UpdateMyPresenceAction<TPresence>>] => {
314
+ ): [Id<T>, Dispatch<UpdateMyPresenceAction<TPresence>>] => {
315
315
  const room = usePluvRoom();
316
316
 
317
317
  const subscribe = useCallback(
@@ -324,9 +324,7 @@ export const createRoomBundle = <
324
324
  const getSnapshot = room.getMyPresence;
325
325
 
326
326
  const _selector = useCallback(
327
- (snapshot: TPresence | null) => {
328
- return !snapshot ? null : (selector(snapshot) as Id<T>);
329
- },
327
+ (snapshot: TPresence) => selector(snapshot) as Id<T>,
330
328
  [selector]
331
329
  );
332
330