mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-25 12:54:09 +02:00
Add a typed platform package to decouple the frontend from Tauri (#539)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
0068be9ffc
commit
2383f06e71
@@ -3,7 +3,7 @@ import type { AnyModel, ModelPayload } from "@yaakapp-internal/models";
|
||||
import { watchWorkspaceFiles } from "@yaakapp-internal/sync";
|
||||
import { syncWorkspace } from "../commands/commands";
|
||||
import { activeWorkspaceIdAtom, activeWorkspaceMetaAtom } from "../hooks/useActiveWorkspace";
|
||||
import { listenToTauriEvent } from "../hooks/useListenToTauriEvent";
|
||||
import { platform } from "@yaakapp-internal/platform";
|
||||
import { jotaiStore } from "../lib/jotai";
|
||||
|
||||
export function initSync() {
|
||||
@@ -33,8 +33,8 @@ const syncAfterModelWrite = eagerDebounceAsync(sync, 1000);
|
||||
* simply add long-lived subscribers for the lifetime of the app.
|
||||
*/
|
||||
function initModelListeners() {
|
||||
listenToTauriEvent<ModelPayload[]>("model_writes", (p) => {
|
||||
if (p.payload.some((payload) => isModelRelevant(payload.model))) syncAfterModelWrite();
|
||||
platform.listen<ModelPayload[]>("model_writes", (payloads) => {
|
||||
if (payloads.some((payload) => isModelRelevant(payload.model))) syncAfterModelWrite();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user