You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change allows handlers registered using addStatusHandler to return a Promise. The HMR system will wait until the promise settles before continuing. This allows asynchronous handling of state changes.
In our case, we use this to make sure that when our service worker is modified the update is complete and the service worker installed before the dev server triggers a reload on an unaccepted update.
The diff is much easier to read with ignore whitespace turned on.
What kind of change does this PR introduce?
New feature.
Did you add tests for your changes?
Yes.
Does this PR introduce a breaking change?
No. Handler return values were ignored before, but the worst thing that could happen in the unlikely case that someone was inadvertently returning a Promise from a handler that they weren't expecting to be waited for is that the HMR process might be delayed.
What needs to be documented once your changes are merged?
Document in the Hot Module Replacement Management API section that if a status handler returns a Promise that it will wait for the Promise before continuing.
The text was updated successfully, but these errors were encountered:
A pull request by @rockwalrus was merged and maintainers requested a documentation change.
See pull request: webpack/webpack#13576
This change allows handlers registered using
addStatusHandler
to return aPromise
. The HMR system will wait until the promise settles before continuing. This allows asynchronous handling of state changes.In our case, we use this to make sure that when our service worker is modified the update is complete and the service worker installed before the dev server triggers a reload on an unaccepted update.
The diff is much easier to read with ignore whitespace turned on.
What kind of change does this PR introduce?
New feature.
Did you add tests for your changes?
Yes.
Does this PR introduce a breaking change?
No. Handler return values were ignored before, but the worst thing that could happen in the unlikely case that someone was inadvertently returning a
Promise
from a handler that they weren't expecting to be waited for is that the HMR process might be delayed.What needs to be documented once your changes are merged?
Document in the Hot Module Replacement Management API section that if a status handler returns a
Promise
that it will wait for thePromise
before continuing.The text was updated successfully, but these errors were encountered: