Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explainer for manual commit #259

Merged
merged 2 commits into from
Mar 7, 2023
Merged

Explainer for manual commit #259

merged 2 commits into from
Mar 7, 2023

Conversation

natechapin
Copy link
Collaborator

No description provided.

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

@domenic domenic left a comment

Choose a reason for hiding this comment

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

LGTM with editorial nits!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
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
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.

Copy link
Collaborator Author

@natechapin natechapin Mar 3, 2023

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)?

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: Domenic Denicola <[email protected]>
@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 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