1
0
mirror of synced 2025-12-22 11:26:57 -05:00

Two little tweaks post ai search ship (#54265)

This commit is contained in:
Kevin Heis
2025-02-05 13:08:52 -08:00
committed by GitHub
parent b099e4a9e3
commit ce3ed1f01d
2 changed files with 3 additions and 3 deletions

View File

@@ -43,7 +43,6 @@ export function useQueryParam(
// If the query param changes in the URL, update the state // If the query param changes in the URL, update the state
useEffect(() => { useEffect(() => {
console.log('updating state')
const paramValue = router.query[queryParamKey] const paramValue = router.query[queryParamKey]
if (paramValue) { if (paramValue) {

View File

@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import throttle from 'lodash/throttle'
export function useInnerWindowWidth() { export function useInnerWindowWidth() {
const hasWindow = typeof window !== 'undefined' const hasWindow = typeof window !== 'undefined'
@@ -14,9 +15,9 @@ export function useInnerWindowWidth() {
useEffect(() => { useEffect(() => {
if (hasWindow) { if (hasWindow) {
const handleResize = function () { const handleResize = throttle(function () {
setWidth(getWidth()) setWidth(getWidth())
} }, 100)
window.addEventListener('resize', handleResize) window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize) return () => window.removeEventListener('resize', handleResize)