Skip to content

Commit

Permalink
Best to return 0 on SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Jul 8, 2023
1 parent e08ee6b commit 2c03da3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/tools/useWindowInnerSize.ts
Expand Up @@ -5,12 +5,12 @@ import { Evt } from "evt";
import { useEvt } from "evt/hooks/useEvt";
import { isBrowser } from "./isBrowser";

/** Returns -1 values on the server side */
/** Returns 0 values on the server side */
export function useWindowInnerSize() {

const [dimensions, setDimensions] = useState(() => ({
"windowInnerWidth": !isBrowser ? -1 : window.innerWidth,
"windowInnerHeight": !isBrowser ? -1 : window.innerHeight
"windowInnerWidth": !isBrowser ? 0 : window.innerWidth,
"windowInnerHeight": !isBrowser ? 0 : window.innerHeight
}));

useEvt(ctx =>
Expand Down
2 changes: 1 addition & 1 deletion src/useWindowInnerSize.ts
Expand Up @@ -2,7 +2,7 @@
import { useWindowInnerSize as useRealWindowInnerSize } from "./tools/useWindowInnerSize";
import { useViewPortState } from "./ViewPortAdapter";

/** Returns -1 values on the server side */
/** Returns 0 values on the server side */
export function useWindowInnerSize() {

const { viewPortState } = useViewPortState();
Expand Down

0 comments on commit 2c03da3

Please sign in to comment.