Fixed key/value stuff

This commit is contained in:
Gregory Schier
2023-03-29 14:46:36 -07:00
parent 06ce7abfb9
commit 4b2c1b18a9
5 changed files with 41 additions and 21 deletions

View File

@@ -13,12 +13,10 @@ import { keyValueQueryKey } from '../hooks/useKeyValue';
import { requestsQueryKey } from '../hooks/useRequests';
import { responsesQueryKey } from '../hooks/useResponses';
import { routePaths } from '../hooks/useRoutes';
import type { SidebarDisplay } from '../hooks/useSidebarDisplay';
import { sidebarDisplayDefaultValue, sidebarDisplayKey } from '../hooks/useSidebarDisplay';
import { workspacesQueryKey } from '../hooks/useWorkspaces';
import { DEFAULT_FONT_SIZE } from '../lib/constants';
import { debounce } from '../lib/debounce';
import { extractKeyValue, getKeyValue, setKeyValue } from '../lib/keyValueStore';
import { extractKeyValue } from '../lib/keyValueStore';
import type { HttpRequest, HttpResponse, KeyValue, Workspace } from '../lib/models';
import { AppRouter } from './AppRouter';
import { DialogProvider } from './DialogContext';
@@ -161,17 +159,6 @@ await listen('refresh', () => {
location.reload();
});
await listen('toggle_sidebar', async () => {
const display = await getKeyValue<SidebarDisplay>({
key: sidebarDisplayKey,
fallback: sidebarDisplayDefaultValue,
});
await setKeyValue({
key: sidebarDisplayKey,
value: { width: display.width, hidden: !display.hidden },
});
});
await listen('zoom', ({ payload: zoomDelta }: { payload: number }) => {
const fontSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);

View File

@@ -1,8 +1,9 @@
import { Suspense } from 'react';
import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom';
import { routePaths } from '../hooks/useRoutes';
import Workspace from './Workspace';
import { useTauriListeners } from '../hooks/useTauriListeners';
import RouteError from './RouteError';
import Workspace from './Workspace';
import Workspaces from './Workspaces';
const router = createBrowserRouter([
@@ -34,6 +35,7 @@ const router = createBrowserRouter([
]);
export function AppRouter() {
useTauriListeners();
return (
<Suspense>
<RouterProvider router={router} />