Skip to content

fix(InterceptedHistoryApi): Only override pushState and replaceState#178

Merged
webJose merged 1 commit intomainfrom
JP/InterceptedHistoryApi
Dec 10, 2025
Merged

fix(InterceptedHistoryApi): Only override pushState and replaceState#178
webJose merged 1 commit intomainfrom
JP/InterceptedHistoryApi

Conversation

@webJose
Copy link
Contributor

@webJose webJose commented Dec 10, 2025

Fixes #174.

@webJose webJose requested a review from Copilot December 10, 2025 15:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the InterceptedHistoryApi to selectively override only the pushState and replaceState methods of the browser's window.history object, rather than replacing the entire history object. This is a more surgical approach that reduces potential side effects and maintains better compatibility with other code that might interact with the history API.

Key changes:

  • Store and override only pushState and replaceState methods instead of replacing the entire history object
  • Update disposal logic to restore only the overridden methods
  • Update tests to verify method-level overrides rather than object replacement

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lib/kernel/InterceptedHistoryApi.svelte.ts Changed from storing/replacing entire history object to storing/overriding only pushState and replaceState methods
src/lib/kernel/InterceptedHistoryApi.svelte.test.ts Updated tests to verify method-level interception and restoration instead of object replacement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@webJose webJose merged commit 58a99d5 into main Dec 10, 2025
1 check passed
@webJose webJose deleted the JP/InterceptedHistoryApi branch December 10, 2025 15:56
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.

TypeError: setting getter-only property "history" when using initFull

2 participants