Persist is working when implemented like this as per zustand documentation:
const useUserStore = create<UserState>()(
persist(
(set) => ({
userId: crypto.randomUUID(),
setUserId: (userId: any) => set({ userId }),
}),
{ name: "myioko-user-storage" }
)
);