@satanwagen/reviewkit 0.1.4 → 0.1.5

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ReviewKit
3
- } from "./chunk-5MAFDRUI.js";
3
+ } from "./chunk-VNRVRNZX.js";
4
4
  import {
5
5
  ITEM_STATUSES,
6
6
  KNOWN_ITEM_TYPES,
package/dist/lazy.cjs CHANGED
@@ -5074,6 +5074,11 @@ var init_identity = __esm({
5074
5074
  });
5075
5075
 
5076
5076
  // src/client/sync.ts
5077
+ function normalizeRoute(route) {
5078
+ let r = String(route ?? "/");
5079
+ if (!r.startsWith("/")) r = "/" + r;
5080
+ return r.length > 1 ? r.replace(/\/+$/, "") : r;
5081
+ }
5077
5082
  function resolveSyncUrl(config) {
5078
5083
  return typeof config.syncUrl === "string" && config.syncUrl !== "" ? config.syncUrl : DEFAULT_SYNC_URL;
5079
5084
  }
@@ -5152,8 +5157,11 @@ function useRealtimeSync(state, rawDispatch, config, reducer2) {
5152
5157
  for (const id2 of deletedIds) dispatch({ type: "REMOTE_DELETE", id: id2 });
5153
5158
  dispatch({ type: "PEERS_SET", peers: peers.filter((peer) => peer.id !== id).map(toPeerState) });
5154
5159
  const serverIds = new Set(items.map((item) => item.id));
5160
+ const here = normalizeRoute(window.location.pathname);
5155
5161
  for (const item of stateRef.current.session?.items ?? []) {
5156
- if (!serverIds.has(item.id) && !deleted.has(item.id)) sync.addItem(item);
5162
+ if (serverIds.has(item.id) || deleted.has(item.id)) continue;
5163
+ if (normalizeRoute(item.route) !== here) continue;
5164
+ sync.addItem(item);
5157
5165
  }
5158
5166
  },
5159
5167
  onPeerJoin: (peer) => dispatch({