Skip to content

Re-subscribe listeners after a back-forward cache restore - #152

Open
hhunaid wants to merge 1 commit into
mainfrom
events-resubscribe-on-pageshow
Open

Re-subscribe listeners after a back-forward cache restore#152
hhunaid wants to merge 1 commit into
mainfrom
events-resubscribe-on-pageshow

Conversation

@hhunaid

@hhunaid hhunaid commented Jul 29, 2026

Copy link
Copy Markdown
Member

When iOS clears event subscriptions on didCommitNavigation, a back-forward restore that reuses the document re-clears them - but the page's scripts don't re-run, so nothing calls addListener again, and every listener on the page dies silently.

pageshow with persisted: true is the one signal that fires on a bfcache restore. On it, re-send median://events/subscribe for every event name that still has a registered callback.

WebKit reuses the document on a bfcache restore without re-running the
page's scripts, so median://events/subscribe is never re-sent and every
listener on the page goes dead. Re-subscribe on pageshow with persisted.
@kevzbldai
kevzbldai self-requested a review July 30, 2026 00:37
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.

2 participants