Skip to content

Commit ab56540

Browse files
authored
Even simpler tab flicker fix (#1421)
1 parent 925389f commit ab56540

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

frontend/app/store/global.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ function setPlatform(platform: NodeJS.Platform) {
4343
PLATFORM = platform;
4444
}
4545

46-
// Used to override the tab id when switching tabs to prevent flicker in the tab bar.
47-
const overrideStaticTabAtom = atom(null) as PrimitiveAtom<string>;
48-
4946
function initGlobalAtoms(initOpts: GlobalInitOptions) {
5047
const windowIdAtom = atom(initOpts.windowId) as PrimitiveAtom<string>;
5148
const clientIdAtom = atom(initOpts.clientId) as PrimitiveAtom<string>;
@@ -658,10 +655,6 @@ function createTab() {
658655
}
659656

660657
function setActiveTab(tabId: string) {
661-
// 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.
662-
// Also overrides the staticTabAtom to the new tab id so that the active tab is set correctly.
663-
globalStore.set(overrideStaticTabAtom, tabId);
664-
document.body.classList.add("nohover");
665658
getApi().setActiveTab(tabId);
666659
}
667660

@@ -688,7 +681,6 @@ export {
688681
isDev,
689682
loadConnStatus,
690683
openLink,
691-
overrideStaticTabAtom,
692684
PLATFORM,
693685
pushFlashError,
694686
pushNotification,

frontend/wave.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
initGlobal,
2323
initGlobalWaveEventSubs,
2424
loadConnStatus,
25-
overrideStaticTabAtom,
2625
pushFlashError,
2726
pushNotification,
2827
removeNotificationById,
@@ -89,16 +88,15 @@ async function reinitWave() {
8988
console.log("Reinit Wave");
9089
getApi().sendLog("Reinit Wave");
9190

92-
// 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.
93-
// Also overrides the staticTabAtom to the new tab id so that the active tab is set correctly.
94-
globalStore.set(overrideStaticTabAtom, savedInitOpts.tabId);
91+
// We use this hack to prevent a flicker of the previously-hovered tab when this view was last active.
92+
document.body.classList.add("nohover");
9593
requestAnimationFrame(() =>
9694
setTimeout(() => {
9795
document.body.classList.remove("nohover");
9896
}, 100)
9997
);
10098

101-
const client = await WOS.reloadWaveObject<Client>(WOS.makeORef("client", savedInitOpts.clientId));
99+
await WOS.reloadWaveObject<Client>(WOS.makeORef("client", savedInitOpts.clientId));
102100
const waveWindow = await WOS.reloadWaveObject<WaveWindow>(WOS.makeORef("window", savedInitOpts.windowId));
103101
const ws = await WOS.reloadWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
104102
const initialTab = await WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", savedInitOpts.tabId));

0 commit comments

Comments
 (0)