From 985fa2f7c99832cdf3c3351d2273c8fd05402b78 Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 17 Sep 2025 21:45:18 +0700 Subject: basic comms working --- front/src/state/state.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'front/src/state/state.ts') diff --git a/front/src/state/state.ts b/front/src/state/state.ts index 01b8ea1..2e747ea 100644 --- a/front/src/state/state.ts +++ b/front/src/state/state.ts @@ -6,6 +6,7 @@ import { create } from "zustand"; import type { UserProfile } from "@/types/nostrill"; import type { Event } from "@/types/nostr"; import type { FC, Poast } from "@/types/trill"; +import { useShallow } from "zustand/shallow"; // TODO handle airlock connection issues // the SSE pipeline has a "status-update" event FWIW // type AirlockState = "connecting" | "connected" | "failed"; @@ -27,7 +28,7 @@ export type LocalState = { }; const creator = create(); -const useLocalState = creator((set, get) => ({ +export const useStore = creator((set, get) => ({ isNew: false, api: null, init: async () => { @@ -78,4 +79,8 @@ const useLocalState = creator((set, get) => ({ setComposerData: (composerData) => set({ composerData }), })); -export default useLocalState; +const useShallowStore = any>( + selector: T, +): ReturnType => useStore(useShallow(selector)); + +export default useShallowStore; -- cgit v1.2.3