[csswg-drafts] [css-view-transitions-2] Extend `waitUntil` so that it can replace a set promise (#13014)

bramus has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-2] Extend `waitUntil` so that it can replace a set promise ==
In https://github.com/w3c/csswg-drafts/issues/9901 we resolved on adding [`ViewTransition.waitUntil()`](https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-waituntil) which delays the view transition finish until the given promise is settled.

In https://github.com/WebKit/standards-positions/issues/564 @nt1m [brought up](https://github.com/WebKit/standards-positions/issues/564#issuecomment-3428561660) the following point:

> - It wasn't clear until I read the spec what happened if you called waitUntil() multiple times. I originally thought it would replace the existing promise, instead of adding on top.

As discussed [on the call back when we resolved on adding this](https://github.com/w3c/csswg-drafts/issues/9901#issuecomment-2165674531), this method is modeled after [`ExtenableEvent.waitUntil` as used with Service Workers](https://w3c.github.io/ServiceWorker/#dom-extendableevent-waituntil), so that explains why it doesn’t an existing promise (should there be one).

In case one wants to overwrite any of the promises, perhaps we could extend `waitUntil` to accept an object? I’m thinking of an extra `mode` option to indicate that one wants to replace the existing promise, instead of appending to the list of promises.

```js
ViewTransition.waitUntil({
  promise: myPromise,
  mode: 'replace',
});
```

/cc @vmpstr @noamr @jakearchibald 



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13014 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 24 October 2025 09:23:50 UTC