I'm running a project in Zustand, and have a store for a connection to a sewing machine. I've also got a home interface that shows whether or not the isConnected flag is true:
export const useSewingMachineStore = create<SewingMachine>()(
persist(
(set) => ({
machine: null,
machineEvents: null,
isConnected: false,
}),
{
name: 'sewingMachingStore',
storage: createJSONStorage(() => AsyncStorage),
partialize: (state) => ({
machine: state.machine,
machineEvents: state.machineEvents,
isConnected: false
})
}
)
)
Partialize doesn't seem to be running, as while the machine and machineEvents are the same, the isConnected persists as well instead of becoming false after every startup. Does anyone know if it has to do with the storage being Asynchronous? I can't seem to make synchronous storage run for zustand.
I've tried to get rid of the storage line, I've tried to use the documented implementation for omitting and including, and nothing just seems to work.