Fix narrow-screen initial render in FinderWindow
This commit is contained in:
parent
d120719abd
commit
2695c7055b
1 changed files with 3 additions and 1 deletions
|
|
@ -17,7 +17,9 @@ interface FinderWindowProps {
|
||||||
const NARROW_QUERY = '(max-width: 767px)';
|
const NARROW_QUERY = '(max-width: 767px)';
|
||||||
|
|
||||||
export function useIsNarrow(): boolean {
|
export function useIsNarrow(): boolean {
|
||||||
const [isNarrow, setIsNarrow] = useState(false);
|
const [isNarrow, setIsNarrow] = useState(() =>
|
||||||
|
typeof window !== 'undefined' ? window.matchMedia(NARROW_QUERY).matches : false,
|
||||||
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window === 'undefined') return;
|
if (typeof window === 'undefined') return;
|
||||||
const mq = window.matchMedia(NARROW_QUERY);
|
const mq = window.matchMedia(NARROW_QUERY);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue