Skip to content

Commit

Permalink
Match initial value to SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
moraleslevi committed Oct 24, 2024
1 parent 8c57ef5 commit bc4714d
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ interface Props {
export const MediaQueryProvider = function MediaQueryProvider({
children,
}: Props) {
const [isNavigationCollapsed, setIsNavigationCollapsed] = useState(
navigationBarCollapsed().matches,
);
const [isNavigationCollapsed, setIsNavigationCollapsed] = useState(false);

// eslint-disable-next-line react-hooks/exhaustive-deps
const handleResize = useCallback(

Check failure on line 18 in polaris-react/src/components/MediaQueryProvider/MediaQueryProvider.tsx

View workflow job for this annotation

GitHub Actions / Lint & type check

React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead
debounce(
() => {
if (isNavigationCollapsed !== navigationBarCollapsed().matches) {
setIsNavigationCollapsed(!isNavigationCollapsed);
const matches = navigationBarCollapsed().matches;
if (isNavigationCollapsed !== matches) {
setIsNavigationCollapsed(matches);
}
},
40,
Expand Down

0 comments on commit bc4714d

Please sign in to comment.