@@ -102,31 +102,21 @@ export default <
102102 // console.log("to: ",loadedByUser);
103103 } ;
104104
105- if ( initialOptions . adapter ?. pushLocation ) {
106- initialOptions . adapter . pushLocation = new Proxy (
107- initialOptions . adapter . pushLocation ,
108- {
109- apply : ( target , thisArg , argArray ) => {
110- // trigger here what you need
111- initialize ( ) ;
112- return target . apply ( thisArg , argArray ) ;
113- } ,
114- }
115- ) ;
116- }
117-
118- if ( initialOptions . adapter ?. replaceLocation ) {
119- initialOptions . adapter . replaceLocation = new Proxy (
120- initialOptions . adapter . replaceLocation ,
121- {
122- apply : ( target , thisArg , argArray ) => {
123- // trigger here what you need
124- initialize ( ) ;
125- return target . apply ( thisArg , argArray ) ;
126- } ,
127- }
128- ) ;
129- }
105+ window . history . pushState = new Proxy ( window . history . pushState , {
106+ apply : ( target , thisArg , argArray ) => {
107+ // trigger here what you need
108+ initialize ( ) ;
109+ return target . apply ( thisArg , argArray ) ;
110+ } ,
111+ } ) ;
112+
113+ window . history . replaceState = new Proxy ( window . history . replaceState , {
114+ apply : ( target , thisArg , argArray ) => {
115+ // trigger here what you need
116+ initialize ( ) ;
117+ return target . apply ( thisArg , argArray ) ;
118+ } ,
119+ } ) ;
130120
131121 const useNavQueryParams = < TInputRouteKey extends keyof T > (
132122 key : TInputRouteKey
@@ -356,10 +346,11 @@ export default <
356346 params . delete ( key ) ;
357347 }
358348 } ) ;
349+ const stringParams = params . toString ( ) ;
359350 if ( options . behaviour === "push" ) {
360- adapter . pushLocation ( { search : params . toString ( ) } ) ;
351+ adapter . pushLocation ( { search : stringParams } ) ;
361352 } else {
362- adapter . replaceLocation ( { search : params . toString ( ) } ) ;
353+ adapter . replaceLocation ( { search : stringParams } ) ;
363354 }
364355 } ,
365356 [ query ]
0 commit comments