@@ -172,15 +172,18 @@ const useOnLocationChange = (
172172 // pushState/replaceState don't emit events: patch them
173173 const origPush = history . pushState ;
174174 const origReplace = history . replaceState ;
175-
176- history . pushState = function ( ...args ) {
177- origPush . apply ( this , args ) ;
178- notify ( ) ;
179- } ;
180- history . replaceState = function ( ...args ) {
181- origReplace . apply ( this , args ) ;
182- notify ( ) ;
183- } ;
175+ if ( history . pushState === origPush ) {
176+ history . pushState = function ( ...args ) {
177+ origPush . apply ( this , args ) ;
178+ notify ( ) ;
179+ } ;
180+ }
181+ if ( history . replaceState === origReplace ) {
182+ history . replaceState = function ( ...args ) {
183+ origReplace . apply ( this , args ) ;
184+ notify ( ) ;
185+ } ;
186+ }
184187
185188 // Optional: Navigation API (Chromium, evolving support)
186189 // const nav: any = (window as any).navigation;
@@ -214,9 +217,7 @@ export const KindeProvider = ({
214217} : KindeProviderProps ) => {
215218 const mergedCallbacks = { ...defaultCallbacks , ...callbacks } ;
216219
217- useOnLocationChange ( ( ) => {
218- updateActivityTimestamp ( ) ;
219- } ) ;
220+ useOnLocationChange ( updateActivityTimestamp ) ;
220221
221222 useEffect ( ( ) => {
222223 setActiveStorage ( store ) ;
@@ -239,9 +240,9 @@ export const KindeProvider = ({
239240 const refreshToken = tokens ?. refreshToken ;
240241
241242 await Promise . all ( [
242- await fetch ( `${ domain } /logout` ) ,
243+ fetch ( `${ domain } /logout` ) ,
243244 refreshToken &&
244- ( await fetch ( `${ domain } /oauth2/revoke` , {
245+ fetch ( `${ domain } /oauth2/revoke` , {
245246 method : "POST" ,
246247 body : JSON . stringify ( {
247248 token : refreshToken ,
@@ -250,7 +251,7 @@ export const KindeProvider = ({
250251 "Content-Type" : "application/json" ,
251252 Authorization : `Bearer ${ accessToken } ` ,
252253 } ,
253- } ) ) ,
254+ } ) ,
254255 ] ) ;
255256 if ( accessToken ) {
256257 await fetch ( `${ domain } /oauth2/revoke` , {
0 commit comments