@emeryld/rrroutes-client 2.6.11 → 2.6.13

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/dist/index.cjs CHANGED
@@ -2734,7 +2734,7 @@ function roomsFromData(data, args, toRooms) {
2734
2734
  let state = { rooms: [] };
2735
2735
  const add = (input) => {
2736
2736
  const mergeForValue = (value) => {
2737
- state = mergeRoomState(state, toRooms(value, ...args));
2737
+ state = mergeRoomState(state, toRooms(value, args));
2738
2738
  };
2739
2739
  if (Array.isArray(input)) {
2740
2740
  input.forEach((entry) => mergeForValue(entry));
@@ -2759,21 +2759,12 @@ function roomsFromData(data, args, toRooms) {
2759
2759
  }
2760
2760
 
2761
2761
  // src/sockets/socketedRoute/socket.client.helper.route.ts
2762
- function isSocketClientUnavailableError(err) {
2763
- return err instanceof Error && err.message.includes("SocketClient not found");
2764
- }
2765
2762
  function buildSocketedRoute(options) {
2766
2763
  const { built, toRooms, applySocket, useSocketClient: useSocketClient2, debug } = options;
2767
2764
  const { useEndpoint: useInnerEndpoint, ...rest } = built;
2768
2765
  const useEndpoint = (...useArgs) => {
2769
- let client = null;
2766
+ const client = useSocketClient2();
2770
2767
  let socketClientError = null;
2771
- try {
2772
- client = useSocketClient2();
2773
- } catch (err) {
2774
- if (!isSocketClientUnavailableError(err)) throw err;
2775
- socketClientError = err;
2776
- }
2777
2768
  const endpointResult = useInnerEndpoint(
2778
2769
  ...useArgs
2779
2770
  );
@@ -2781,7 +2772,7 @@ function buildSocketedRoute(options) {
2781
2772
  const [roomState, setRoomState] = (0, import_react5.useState)(
2782
2773
  () => roomsFromData(
2783
2774
  endpointResult.data,
2784
- useArgs,
2775
+ useArgs[0],
2785
2776
  toRooms
2786
2777
  )
2787
2778
  );
@@ -2839,7 +2830,7 @@ function buildSocketedRoute(options) {
2839
2830
  setRoomState((prev) => {
2840
2831
  const next = mergeRoomState(
2841
2832
  prev,
2842
- toRoomsRef.current(data, ...useArgs)
2833
+ toRoomsRef.current(data, useArgs[0])
2843
2834
  );
2844
2835
  return roomStateEqual(prev, next) ? prev : next;
2845
2836
  });
@@ -2857,7 +2848,7 @@ function buildSocketedRoute(options) {
2857
2848
  toRoomsRef: describeObjectReference(toRooms)
2858
2849
  }
2859
2850
  });
2860
- const next = roomsFromData(endpointDataRef.current, useArgs, toRooms);
2851
+ const next = roomsFromData(endpointDataRef.current, useArgs[0], toRooms);
2861
2852
  setRoomState((prev) => roomStateEqual(prev, next) ? prev : next);
2862
2853
  }, [argsKey, toRooms, debug]);
2863
2854
  (0, import_react5.useEffect)(() => {
@@ -2973,11 +2964,12 @@ function buildSocketedRoute(options) {
2973
2964
  if (!nextUpdate) continue;
2974
2965
  built.setData(
2975
2966
  (prev) => {
2976
- const next = nextUpdate.fn(
2967
+ const next = nextUpdate.fn({
2977
2968
  prev,
2978
- nextUpdate.payload,
2979
- nextUpdate.meta ? { ...nextUpdate.meta, args: useArgs } : { args: useArgs }
2980
- );
2969
+ payload: nextUpdate.payload,
2970
+ args: useArgs[0],
2971
+ meta: nextUpdate.meta ?? {}
2972
+ });
2981
2973
  if (next === null) return prev;
2982
2974
  if (shouldWarnSocketMutationGuard() && isSameObjectReference(prev, next) && !sameRefWarnedEvents.has(nextUpdate.event)) {
2983
2975
  sameRefWarnedEvents.add(nextUpdate.event);
@@ -2987,7 +2979,7 @@ function buildSocketedRoute(options) {
2987
2979
  }
2988
2980
  const nextRoomState = roomsFromData(
2989
2981
  next,
2990
- useArgs,
2982
+ useArgs[0],
2991
2983
  toRooms
2992
2984
  );
2993
2985
  setRoomState(