diff --git a/src/client/init.ts b/src/client/init.ts index 74b1461187..b37a5fdaac 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -94,8 +94,8 @@ document.addEventListener('touchend', () => {}, { passive: true }); // 一斉リロード reloadChannel.addEventListener('message', path => { - if (path === 'reload') location.reload(); - else location.href = path; + if (path !== null) location.href = path; + else location.reload(); }); //#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ diff --git a/src/client/scripts/unison-reload.ts b/src/client/scripts/unison-reload.ts index 745a0a7a1d..59af584c1b 100644 --- a/src/client/scripts/unison-reload.ts +++ b/src/client/scripts/unison-reload.ts @@ -1,7 +1,7 @@ // SafariがBroadcastChannel未実装なのでライブラリを使う import { BroadcastChannel } from 'broadcast-channel'; -export const reloadChannel = new BroadcastChannel('reload'); +export const reloadChannel = new BroadcastChannel('reload'); // BroadcastChannelを用いて、クライアントが一斉にreloadするようにします。 export function unisonReload(path?: string) { @@ -9,7 +9,7 @@ export function unisonReload(path?: string) { reloadChannel.postMessage(path); location.href = path; } else { - reloadChannel.postMessage('reload'); + reloadChannel.postMessage(null); location.reload(); } }