diff --git a/src/views/RedirectsView.svelte b/src/views/RedirectsView.svelte index a69ad7f..da5da95 100644 --- a/src/views/RedirectsView.svelte +++ b/src/views/RedirectsView.svelte @@ -26,7 +26,7 @@ return p.endsWith(domain); } - let promiseForTable: Promise = reloadTable(); + let promiseForTable: Promise = Object.keys($redirectsTable).length === 0 ? reloadTable() : Promise.resolve(); function reloadTable(): Promise { return new Promise((res, rej) => { @@ -37,12 +37,17 @@ }) .then(x => { let rows = x as Redirect[]; + let srcs = new Set(Object.keys($redirectsTable)); rows.forEach(x => { $redirectsTable[x.src] = { client: !$redirectsTable[x.src] ? JSON.parse(JSON.stringify(x)) : $redirectsTable[x.src]?.client, server: x, p: Promise.resolve(), }; + srcs.delete(x.src); + }); + srcs.forEach(x => { + $redirectsTable[x].server = null; }); res(); }) diff --git a/src/views/RoutesView.svelte b/src/views/RoutesView.svelte index bf17b65..03edd57 100644 --- a/src/views/RoutesView.svelte +++ b/src/views/RoutesView.svelte @@ -26,7 +26,7 @@ return p.endsWith(domain); } - let promiseForTable: Promise = reloadTable(); + let promiseForTable: Promise = Object.keys($routesTable).length === 0 ? reloadTable() : Promise.resolve(); function reloadTable(): Promise { return new Promise((res, rej) => {