Skip to content

Conversation

dsrominiyi
Copy link

With each navigation, the original pushState implementation is increasingly nested within patched versions of itself.

tomcru added a commit to tomcru/holy-loader that referenced this pull request Feb 26, 2024
The previous implementation of patching the History API methods (pushState and replaceState) was causing them to increasingly nest within patched versions of themselves.

To fix this, a new flag `isHistoryPatched` was introduced to prevent redundant patching. The `stopProgressOnHistoryUpdate` function now checks if the flag is already set before applying the patch. Additionally, the flag is set to `true` after the patching is done to ensure it is only applied once.

Reference: TheSGJ/nextjs-toploader#68
@TheSGJ TheSGJ force-pushed the master branch 2 times, most recently from b706e90 to b5db4c1 Compare July 21, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant