This commit is contained in:
2026-02-12 10:24:03 +09:00
parent 3cea3e66d0
commit 8f1d75b4d5
41 changed files with 22902 additions and 43669 deletions

View File

@@ -34,6 +34,8 @@ interface KisRuntimeStoreState {
wsApprovalKey: string | null;
wsUrl: string | null;
_hasHydrated: boolean;
}
interface KisRuntimeStoreActions {
@@ -48,6 +50,7 @@ interface KisRuntimeStoreActions {
invalidateKisVerification: () => void;
clearKisRuntimeSession: (tradingEnv: KisTradingEnv) => void;
getOrFetchWsConnection: () => Promise<KisWsConnection | null>;
setHasHydrated: (state: boolean) => void;
}
const INITIAL_STATE: KisRuntimeStoreState = {
@@ -60,6 +63,7 @@ const INITIAL_STATE: KisRuntimeStoreState = {
tradingEnv: "real",
wsApprovalKey: null,
wsUrl: null,
_hasHydrated: false,
};
const RESET_VERIFICATION_STATE = {
@@ -173,10 +177,18 @@ export const useKisRuntimeStore = create<
return wsConnectionPromise;
},
setHasHydrated: (state) => {
set({
_hasHydrated: state,
});
},
}),
{
name: "autotrade-kis-runtime-store",
storage: createJSONStorage(() => localStorage),
onRehydrateStorage: () => (state) => {
state?.setHasHydrated(true);
},
partialize: (state) => ({
kisTradingEnvInput: state.kisTradingEnvInput,
kisAppKeyInput: state.kisAppKeyInput,