Post

So excited by this. Related, but kind of general question: how stable is the API? I've been going through the GitHub issues for how I might implement a "rollback" after an intercept, and it looks like there have been a few of solutions: commit: 'after-transition', event.commit(), & precommitHandler.

Do these things become a bit more stable once they are baseline? (and also, how might I determine support for precommitHandler? will `if (NavigationPrecommitController) work?`

Depends what you mean by stable. It would be a web compat issue to change their behaviour now, so that's unlikely to happy. Additions may be made, such as precommitController.addHandler(). self.NavigationPrecommitController is a good feature test.

If you reject during the precommitHandler, then the navigation is aborted, but if you want to 'roll back' after commit, then you'll need to traverse back or replace the current history state. In terms of stability, there's always the possibility of bugs, but the methods won't change now.

Great, thanks. I was having a play with rolling back with Safari 26.2 and had a hard time getting the history entries to be "correct" from a user perspective. It looks like precommitHandler solves this, so 🤞for Safari support soon

This is so much cleaner. I've told students to avoid rolling their own solutions using the history API because it's so messy, but this makes it feel much more in reach

I released a polyfill with pretty good good support for navigation history entries. As I start to think about how to tackle navigation transition lifecycle (Navigate event, cancellation, interceptors, etc.) I was wondering if you have any wisdom to share in the parts you think are impossible? 🙏🏼

Keeping the browser loading spinner going pops to mind, but there may be more. Things like knowing a navigation is just a `hashChange` seems tricky in the case of traversals. As in, how do you know it's same-document or not?

I wouldn’t call it stable yet. It works by patching the history API so that you can use navigation api features in history-based framework routers. I want to make that patching explicitly opt-in so that you could avoid patching altogether and eschew history altogether for a purely navigation router