Skip to content
This repository was archived by the owner on Aug 21, 2026. It is now read-only.

Explainer for manual commit - #259

Merged
natechapin merged 2 commits into
WICG:mainfrom
natechapin:commit
Mar 7, 2023
Merged

natechapin merged 2 commits into
WICG:mainfrom
natechapin:commit

Conversation

@natechapin

Copy link
Copy Markdown
Collaborator

No description provided.

@natechapin
natechapin requested a review from domenic March 2, 2023 22:32

@domenic domenic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with editorial nits!

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated

If a handler passed to `intercept()` rejects before `e.commit()` is called, then the navigation will be treated as canceled (both `committed` and `finished` promises will reject, and no url update will occur). If a handler passed to `intercept()` rejects after `e.commit()` is called, the behavior will match a rejected promise in immediate commit mode (i.e., the `committed` promise will fulfill, the `finished` promise will reject, and the url will update).

Because manual commit can be used to cancel the navigation before the url updates, it is only available when `e.cancelable` is true.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Because manual commit can be used to cancel the navigation before the url updates, it is only available when `e.cancelable` is true.
Because manual commit can be used to cancel the navigation before the URL updates, it is only available when `e.cancelable` is true. See [above](#restrictions-on-firing-canceling-and-responding) for details on when `e.cancelable` is set to false, and thus manual commit is not available.

Also state what will happen if you try to use manual commit when e.cancelable is false. An exception, I assume.

@natechapin natechapin Mar 3, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I haven't finalized that. My draft does a console warning (on the logic that it's better to invalidate the commit option, rather than invalidate the entire intercept). Is it ok to leave that ambiguous in the explainer (since we don't really enumerate every possible exception in other parts of the API)?

Comment thread README.md
Comment thread README.md Outdated
Co-authored-by: Domenic Denicola <d@domenic.me>
@natechapin
natechapin merged commit 150c373 into WICG:main Mar 7, 2023
fabiancook added a commit to virtualstate/navigation that referenced this pull request Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants