From ce3ed1f01d18a215c9938b5748b100e88a193fa5 Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Wed, 5 Feb 2025 13:08:52 -0800 Subject: [PATCH] Two little tweaks post ai search ship (#54265) --- src/frame/components/hooks/useQueryParam.ts | 1 - .../components/page-header/hooks/useInnerWindowWidth.ts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frame/components/hooks/useQueryParam.ts b/src/frame/components/hooks/useQueryParam.ts index ff43ec42acfd..f590e1ebc166 100644 --- a/src/frame/components/hooks/useQueryParam.ts +++ b/src/frame/components/hooks/useQueryParam.ts @@ -43,7 +43,6 @@ export function useQueryParam( // If the query param changes in the URL, update the state useEffect(() => { - console.log('updating state') const paramValue = router.query[queryParamKey] if (paramValue) { diff --git a/src/frame/components/page-header/hooks/useInnerWindowWidth.ts b/src/frame/components/page-header/hooks/useInnerWindowWidth.ts index bb4c4d425508..faf60d062a88 100644 --- a/src/frame/components/page-header/hooks/useInnerWindowWidth.ts +++ b/src/frame/components/page-header/hooks/useInnerWindowWidth.ts @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react' +import throttle from 'lodash/throttle' export function useInnerWindowWidth() { const hasWindow = typeof window !== 'undefined' @@ -14,9 +15,9 @@ export function useInnerWindowWidth() { useEffect(() => { if (hasWindow) { - const handleResize = function () { + const handleResize = throttle(function () { setWidth(getWidth()) - } + }, 100) window.addEventListener('resize', handleResize) return () => window.removeEventListener('resize', handleResize)