@@ -202,10 +202,10 @@ export function useQueryState(key: string): UseQueryStateReturn<string, undefine
202202export function useQueryState < T = string > (
203203 key : string ,
204204 {
205- history = "replace" ,
206- shallow = true ,
207- scroll = false ,
208- throttleMs = FLUSH_RATE_LIMIT_MS ,
205+ history,
206+ shallow,
207+ scroll,
208+ throttleMs,
209209 parse = ( x ) => x as unknown as T ,
210210 serialize = String ,
211211 eq = ( a , b ) => a === b ,
@@ -214,10 +214,6 @@ export function useQueryState<T = string>(
214214 } : Partial < UseQueryStateOptions < T > > & {
215215 defaultValue ?: T ;
216216 } = {
217- history : "replace" ,
218- scroll : false ,
219- shallow : true ,
220- throttleMs : 50 ,
221217 parse : ( x ) => x as unknown as T ,
222218 serialize : String ,
223219 eq : ( a , b ) => a === b ,
@@ -306,12 +302,15 @@ export function useQueryState<T = string>(
306302 newValue = null ;
307303 }
308304
305+ const adapterOptions = adapter . options ;
306+
309307 const query = enqueueQueryStringUpdate ( key , newValue , serialize , {
310- // Call-level options take precedence over hook declaration options
311- history : options . history ?? history ,
312- shallow : options . shallow ?? shallow ,
313- scroll : options . scroll ?? scroll ,
314- throttleMs : options . throttleMs ?? throttleMs ,
308+ // Call-level options take precedence over hook declaration options that take precedence over adapter-level options
309+ history : options . history ?? history ?? adapterOptions ?. history ?? "replace" ,
310+ shallow : options . shallow ?? shallow ?? adapterOptions ?. shallow ?? true ,
311+ scroll : options . scroll ?? scroll ?? adapterOptions ?. scroll ?? false ,
312+ throttleMs :
313+ options . throttleMs ?? throttleMs ?? adapterOptions ?. throttleMs ?? FLUSH_RATE_LIMIT_MS ,
315314 } ) ;
316315
317316 emitter . emit ( key , { state : newValue , query } ) ;
0 commit comments