Skip to content

Commit

Permalink
chore(website): useIsomorphicLayoutEffect to hide SSR warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Apr 2, 2022
1 parent 638c8ec commit aa0d3cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/documentation/src/components/Layout/Layout.tsx
@@ -1,5 +1,5 @@
import type { ReactElement, ReactNode } from "react";
import { useEffect, useRef, useState, useLayoutEffect } from "react";
import { useEffect, useRef, useState } from "react";
import type { ConfiguredIcons } from "@react-md/icon";
import type { LayoutConfiguration } from "@react-md/layout";
import {
Expand All @@ -25,6 +25,7 @@ import {
import type { MenuConfiguration } from "@react-md/menu";
import { useCrossFadeTransition } from "@react-md/transition";
import type { AppSizeListenerProps } from "@react-md/utils";
import { useIsomorphicLayoutEffect } from "@react-md/utils";

import type { CodePreference } from "components/CodePreference";
import { CodePreferenceProvider } from "components/CodePreference";
Expand Down Expand Up @@ -95,7 +96,7 @@ export default function Layout({

const prevPathname = useRef(pathname);
const { elementProps, transitionTo } = useCrossFadeTransition();
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
if (prevPathname.current === pathname) {
return;
}
Expand Down

0 comments on commit aa0d3cd

Please sign in to comment.