fix leave server selected after opening once

This commit is contained in:
Anton Bracke 2022-02-23 11:49:42 +01:00
parent 44a9e2aeb0
commit da6b5b9f60
No known key found for this signature in database
GPG Key ID: B1222603899C6B25
3 changed files with 6 additions and 9 deletions

View File

@ -4,7 +4,7 @@ import { createAndShowNotification } from "./notification";
import { Server } from "./preload-local-app/types";
import settings, { SettingsData } from "./settings";
import { loadShortcuts, setShortcutsEnabled } from "./shortcuts";
import { getAppView, getWindow, hideAppView, showAppView } from "./window";
import { getAppView, hideAppView, showAppView } from "./window";
// import fetch from "node-fetch";
export function emitMuteToggle() {

View File

@ -6,8 +6,9 @@ import { loadCustomScheme } from "./serve";
let mainWindow: BrowserWindow | undefined;
let appView: BrowserView | undefined;
let appViewUrl = "";
const sidebarWidth = 75;
const sidebarWidth = 80;
export function getWindow() {
return mainWindow;
@ -128,8 +129,9 @@ export function showAppView(url?: string) {
}
mainWindow.addBrowserView(appView);
if (url) {
if (url && url !== appViewUrl) {
appView.webContents.loadURL(url);
appViewUrl = url;
}
}

View File

@ -2,7 +2,7 @@
import { onDestroy, onMount } from "svelte";
import { useParams } from "svelte-navigator";
import { selectServer, servers, selectedServer } from "~/store";
import { selectServer, servers } from "~/store";
import { api } from "~/lib/ipc";
const params = useParams();
@ -11,13 +11,8 @@
selectServer(_params.id);
});
onMount(async () => {
await selectServer($params.id);
});
onDestroy(async () => {
await api.showLocalApp();
$selectedServer = "";
});
$: server = $servers.find(({ _id }) => _id === $params.id);