mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-10-26 11:37:06 +00:00
fix(electron): electron cmd+r issue
This commit is contained in:
parent
280e24934a
commit
31071c8308
@ -1,5 +1,5 @@
|
||||
import type { Location } from 'history';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
@ -21,6 +21,7 @@ export function useBindWorkbenchToDesktopRouter(
|
||||
basename: string
|
||||
) {
|
||||
const browserLocation = useLocation();
|
||||
const firstNavigation = useRef(false);
|
||||
useEffect(() => {
|
||||
const newLocation = browserLocationToViewLocation(
|
||||
browserLocation,
|
||||
@ -36,8 +37,19 @@ export function useBindWorkbenchToDesktopRouter(
|
||||
) {
|
||||
return;
|
||||
}
|
||||
workbench.open(newLocation);
|
||||
// skipping default location initialization since we will init the views
|
||||
// using WorkbenchDefaultState
|
||||
if (firstNavigation.current) {
|
||||
workbench.open(newLocation);
|
||||
}
|
||||
}, [basename, browserLocation, workbench]);
|
||||
|
||||
useEffect(() => {
|
||||
firstNavigation.current = true;
|
||||
return () => {
|
||||
firstNavigation.current = false;
|
||||
};
|
||||
}, []);
|
||||
}
|
||||
|
||||
function browserLocationToViewLocation(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user