Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Rewrite tab syncing
Rūdolfs Ošiņš committed 2 years ago
commit 841f1a4e8a939d6c0b1c5357c344ab71cfa1ae38
parent 00ff5c1c38e2bec1cdeb3cd733469003b66baaa7
1 file changed +14 -4
modified src/lib/httpd.ts
@@ -214,11 +214,21 @@ export async function initialize() {
  // Sync session state changes with other open tabs and windows.
  addEventListener("storage", event => {
    if (
-
      (event.key === HTTPD_STATE_STORAGE_KEY &&
-
        event.oldValue !== event.newValue) ||
-
      (event.key === HTTPD_CUSTOM_PORT_KEY && event.oldValue !== event.newValue)
+
      event.key === HTTPD_STATE_STORAGE_KEY &&
+
      event.oldValue !== event.newValue
    ) {
-
      void checkState();
+
      if (!event.newValue) {
+
        throw new Error("event.newValue was not set");
+
      }
+
      const httpdState: HttpdState = JSON.parse(event.newValue);
+
      store.set(httpdState);
+
    }
+

+
    if (
+
      event.key === HTTPD_CUSTOM_PORT_KEY &&
+
      event.oldValue !== event.newValue
+
    ) {
+
      api.changePort(Number(event.newValue));
    }
  });