File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
packages/reactant-share/src Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import type { ISharedAppOptions } from '../interfaces';
3333import { PortDetector } from './portDetector' ;
3434import { delegate } from '../delegate' ;
3535import { fork } from '../fork' ;
36+ import { isSharedWorker } from '../utils' ;
3637
3738export {
3839 createBrowserHistory ,
@@ -380,7 +381,7 @@ class ReactantRouter extends BaseReactantRouter {
380381 /**
381382 * The timestamp of the last routing.
382383 */
383- lastRoutedTimestamp = Date . now ( ) ;
384+ lastRoutedTimestamp = isSharedWorker ? 0 : Date . now ( ) ;
384385
385386 protected _changeRoutingOnSever (
386387 name : string ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313import { PortDetector } from './modules/portDetector' ;
1414import { PatchesChecker } from './modules/patchesChecker' ;
1515import { applyMethod } from './applyMethod' ;
16+ import { isSharedWorker } from './utils' ;
1617
1718export const handleServer = ( {
1819 app,
@@ -32,9 +33,7 @@ export const handleServer = ({
3233 const patchesChecker : PatchesChecker | null = enablePatchesChecker
3334 ? container . get ( PatchesChecker )
3435 : null ;
35- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
36- // @ts -ignore
37- if ( globalThis . SharedWorkerGlobalScope ) {
36+ if ( isSharedWorker ) {
3837 let executed = false ;
3938 // before any other event, it should be connected with the first client
4039 globalThis . addEventListener ( 'connect' , ( ) => {
Original file line number Diff line number Diff line change 11export const createId = ( ) => Math . random ( ) . toString ( 36 ) . slice ( 2 ) ;
2+
3+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4+ // @ts -ignore
5+ export const isSharedWorker = ! ! globalThis . SharedWorkerGlobalScope ;
You can’t perform that action at this time.
0 commit comments