@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.
@@ -4975,6 +4975,11 @@ function currentAuthor(name) {
4975
4975
 
4976
4976
  // src/client/sync.ts
4977
4977
  var DEFAULT_SYNC_URL = "wss://2-59-219-26.sslip.io/rk-sync";
4978
+ function normalizeRoute(route) {
4979
+ let r = String(route ?? "/");
4980
+ if (!r.startsWith("/")) r = "/" + r;
4981
+ return r.length > 1 ? r.replace(/\/+$/, "") : r;
4982
+ }
4978
4983
  function resolveSyncUrl(config) {
4979
4984
  return typeof config.syncUrl === "string" && config.syncUrl !== "" ? config.syncUrl : DEFAULT_SYNC_URL;
4980
4985
  }
@@ -5057,8 +5062,11 @@ function useRealtimeSync(state, rawDispatch, config, reducer2) {
5057
5062
  for (const id2 of deletedIds) dispatch({ type: "REMOTE_DELETE", id: id2 });
5058
5063
  dispatch({ type: "PEERS_SET", peers: peers.filter((peer) => peer.id !== id).map(toPeerState) });
5059
5064
  const serverIds = new Set(items.map((item) => item.id));
5065
+ const here = normalizeRoute(window.location.pathname);
5060
5066
  for (const item of stateRef.current.session?.items ?? []) {
5061
- if (!serverIds.has(item.id) && !deleted.has(item.id)) sync.addItem(item);
5067
+ if (serverIds.has(item.id) || deleted.has(item.id)) continue;
5068
+ if (normalizeRoute(item.route) !== here) continue;
5069
+ sync.addItem(item);
5062
5070
  }
5063
5071
  },
5064
5072
  onPeerJoin: (peer) => dispatch({