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

feat: send data for fallback if hmr apply fails #687

Merged
merged 2 commits into from
Oct 9, 2018

Conversation

KristianDD
Copy link
Contributor

PR Checklist

What is the current behavior?

Currently there is no indication in the log, which hmr patch is applied and in hook args there is no data about the hmr hash and the files that should be synced if the hmr operation fails.

What is the new behavior?

There is a hash added for start, success or fail of the hmr operation and there are properties in the hookArgs which are populated with information about current hmr operation.

Fixes/Implements/Closes #3892.

@KristianDD KristianDD force-pushed the kddimitrov/hmr-fail-fallback branch from a08f7c0 to ce65d6a Compare October 5, 2018 12:02
hot.js Outdated
}
})
.catch((err) => {
const status = module.hot.status();
if (['abort', 'fail'].indexOf(status) >= 0) {
log.warn(`Cannot apply update. ${refresh}`);
log.warn(`Cannot apply update with hmr hash ${currentHash}.`);
log.warn(err.stack || err.message);
if (options.reload) {
window.location.reload();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be removed maybe.

}
})
.catch((err) => {
const status = module.hot.status();
if (['abort', 'fail'].indexOf(status) >= 0) {
log.warn(`Cannot apply update. ${refresh}`);
log.warn(`Cannot apply update with hmr hash ${currentHash}.`);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add comment to not change - it will break CLI

@KristianDD KristianDD force-pushed the kddimitrov/hmr-fail-fallback branch from ce65d6a to 2309498 Compare October 8, 2018 16:24
@@ -90,17 +91,16 @@ function check(options) {
result(modules, appliedModules);

if (upToDate()) {
log.info('App is up to date.');
//Do not modify message - CLI depends on this exact content to determine hmr operation status.
log.info(`Successfully applied update with hmr hash ${currentHash}. App is up to date.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you extract the messages to constants?

@sis0k0 sis0k0 merged commit 47e63f1 into master Oct 9, 2018
@sis0k0 sis0k0 deleted the kddimitrov/hmr-fail-fallback branch October 20, 2018 16:21
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