Even simpler tab flicker fix (#1421)

This commit is contained in:
Evan Simkowitz 2024-12-06 12:13:49 -08:00 committed by GitHub
parent 925389fc70
commit ab565409cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 13 deletions

View File

@ -43,9 +43,6 @@ function setPlatform(platform: NodeJS.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) {
const windowIdAtom = atom(initOpts.windowId) as PrimitiveAtom<string>;
const clientIdAtom = atom(initOpts.clientId) as PrimitiveAtom<string>;
@ -658,10 +655,6 @@ function createTab() {
}
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);
}
@ -688,7 +681,6 @@ export {
isDev,
loadConnStatus,
openLink,
overrideStaticTabAtom,
PLATFORM,
pushFlashError,
pushNotification,

View File

@ -22,7 +22,6 @@ import {
initGlobal,
initGlobalWaveEventSubs,
loadConnStatus,
overrideStaticTabAtom,
pushFlashError,
pushNotification,
removeNotificationById,
@ -89,16 +88,15 @@ async function reinitWave() {
console.log("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.
// Also overrides the staticTabAtom to the new tab id so that the active tab is set correctly.
globalStore.set(overrideStaticTabAtom, savedInitOpts.tabId);
// We use this hack to prevent a flicker of the previously-hovered tab when this view was last active.
document.body.classList.add("nohover");
requestAnimationFrame(() =>
setTimeout(() => {
document.body.classList.remove("nohover");
}, 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 ws = await WOS.reloadWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
const initialTab = await WOS.reloadWaveObject<Tab>(WOS.makeORef("tab", savedInitOpts.tabId));