Clean up model fetching and loading states

This commit is contained in:
Gregory Schier
2025-01-20 13:44:11 -08:00
parent 0453e84d38
commit 8ad7ac0bef
42 changed files with 180 additions and 247 deletions

View File

@@ -1,7 +1,7 @@
// Listen for settings changes, the re-compute theme
import { listen } from '@tauri-apps/api/event';
import type { ModelPayload } from '@yaakapp-internal/models';
import { getSettings } from './lib/store';
import type { ModelPayload, Settings } from '@yaakapp-internal/models';
import { invokeCmd } from './lib/tauri';
function setFontSizeOnDocument(fontSize: number) {
document.documentElement.style.fontSize = `${fontSize}px`;
@@ -12,4 +12,6 @@ listen<ModelPayload>('upserted_model', async (event) => {
setFontSizeOnDocument(event.payload.model.interfaceFontSize);
}).catch(console.error);
getSettings().then((settings) => setFontSizeOnDocument(settings.interfaceFontSize));
invokeCmd<Settings>('cmd_get_settings').then((settings) =>
setFontSizeOnDocument(settings.interfaceFontSize),
);