mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
Even simpler tab flicker fix (#1421)
This commit is contained in:
parent
925389fc70
commit
ab565409cb
@ -43,9 +43,6 @@ function setPlatform(platform: NodeJS.Platform) {
|
|||||||
PLATFORM = platform;
|
PLATFORM = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to override the tab id when switching tabs to prevent flicker in the tab bar.
|
|
||||||
const overrideStaticTabAtom = atom(null) as PrimitiveAtom<string>;
|
|
||||||
|
|
||||||
function initGlobalAtoms(initOpts: GlobalInitOptions) {
|
function initGlobalAtoms(initOpts: GlobalInitOptions) {
|
||||||
const windowIdAtom = atom(initOpts.windowId) as PrimitiveAtom<string>;
|
const windowIdAtom = atom(initOpts.windowId) as PrimitiveAtom<string>;
|
||||||
const clientIdAtom = atom(initOpts.clientId) as PrimitiveAtom<string>;
|
const clientIdAtom = atom(initOpts.clientId) as PrimitiveAtom<string>;
|
||||||
@ -658,10 +655,6 @@ function createTab() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setActiveTab(tabId: string) {
|
function setActiveTab(tabId: string) {
|
||||||
// We use this hack to prevent a flicker of the previously-hovered tab when this view was last active. This class is set in setActiveTab in global.ts. See tab.scss for where this class is used.
|
|
||||||
// Also overrides the staticTabAtom to the new tab id so that the active tab is set correctly.
|
|
||||||
globalStore.set(overrideStaticTabAtom, tabId);
|
|
||||||
document.body.classList.add("nohover");
|
|
||||||
getApi().setActiveTab(tabId);
|
getApi().setActiveTab(tabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,7 +681,6 @@ export {
|
|||||||
isDev,
|
isDev,
|
||||||
loadConnStatus,
|
loadConnStatus,
|
||||||
openLink,
|
openLink,
|
||||||
overrideStaticTabAtom,
|
|
||||||
PLATFORM,
|
PLATFORM,
|
||||||
pushFlashError,
|
pushFlashError,
|
||||||
pushNotification,
|
pushNotification,
|
||||||
|
@ -22,7 +22,6 @@ import {
|
|||||||
initGlobal,
|
initGlobal,
|
||||||
initGlobalWaveEventSubs,
|
initGlobalWaveEventSubs,
|
||||||
loadConnStatus,
|
loadConnStatus,
|
||||||
overrideStaticTabAtom,
|
|
||||||
pushFlashError,
|
pushFlashError,
|
||||||
pushNotification,
|
pushNotification,
|
||||||
removeNotificationById,
|
removeNotificationById,
|
||||||
@ -89,16 +88,15 @@ async function reinitWave() {
|
|||||||
console.log("Reinit Wave");
|
console.log("Reinit Wave");
|
||||||
getApi().sendLog("Reinit Wave");
|
getApi().sendLog("Reinit Wave");
|
||||||
|
|
||||||
// We use this hack to prevent a flicker of the previously-hovered tab when this view was last active. This class is set in setActiveTab in global.ts. See tab.scss for where this class is used.
|
// We use this hack to prevent a flicker of the previously-hovered tab when this view was last active.
|
||||||
// Also overrides the staticTabAtom to the new tab id so that the active tab is set correctly.
|
document.body.classList.add("nohover");
|
||||||
globalStore.set(overrideStaticTabAtom, savedInitOpts.tabId);
|
|
||||||
requestAnimationFrame(() =>
|
requestAnimationFrame(() =>
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.body.classList.remove("nohover");
|
document.body.classList.remove("nohover");
|
||||||
}, 100)
|
}, 100)
|
||||||
);
|
);
|
||||||
|
|
||||||
const client = await WOS.reloadWaveObject<Client>(WOS.makeORef("client", savedInitOpts.clientId));
|
await WOS.reloadWaveObject<Client>(WOS.makeORef("client", savedInitOpts.clientId));
|
||||||
const waveWindow = await WOS.reloadWaveObject<WaveWindow>(WOS.makeORef("window", savedInitOpts.windowId));
|
const waveWindow = await WOS.reloadWaveObject<WaveWindow>(WOS.makeORef("window", savedInitOpts.windowId));
|
||||||
const ws = await WOS.reloadWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
|
const ws = await WOS.reloadWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
|
||||||
const initialTab = await WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", savedInitOpts.tabId));
|
const initialTab = await WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", savedInitOpts.tabId));
|
||||||
|
Loading…
Reference in New Issue
Block a user