If someone have similar error, I found answer. First of all I add
skipHydration: true,
to the store. After thar I made Hydrations
component. It looks like this:
'use client';
import { useAuthStore } from '@/store/auth.store';
import { useEffect } from 'react';
export default function Hydrations() {
useEffect(() => {
useAuthStore.persist.rehydrate();
}, []);
return null;
}
And I import it in layout.tsx
Also, ChatGPT give me that hook, maybe someone neet it. It check if hydration was by now (??). Idk, you can use it if you want.
'use client';
import { useState, useEffect } from 'react';
export function useIsMounted() {
const [isMounted, setIsMounted] = useState(false);
useEffect(() => {
setIsMounted(true);
}, []);
return isMounted;
}