fix: [BACKPORT] backports replaceState monkey patch (#7477)

This commit is contained in:
Anshuman Pandey
2026-03-13 19:26:29 +05:30
committed by GitHub

View File

@@ -175,6 +175,16 @@ export const addPageUrlEventListeners = (): void => {
window.dispatchEvent(event);
};
// eslint-disable-next-line @typescript-eslint/unbound-method -- We need to access the original method
const originalReplaceState = history.replaceState;
// eslint-disable-next-line func-names -- We need an anonymous function here
history.replaceState = function (...args) {
originalReplaceState.apply(this, args);
const event = new Event("replacestate");
window.dispatchEvent(event);
};
isHistoryPatched = true;
}