aurelia / dialog

A dialog plugin for Aurelia.
MIT License
106 stars 115 forks source link

Hot Module Replacement with Webpack doesn't refresh in a dialog #299

Open ClintGeense opened 7 years ago

ClintGeense commented 7 years ago

I'm submitting a bug report

Please tell us about your environment:

WebpackVersion 2.4.1

We are using Webpack's "Hot Module Replacement". This updates the view while running when changing .less files. When we want to style a dialog, this stops working. When I reload the page, the CSS is updated.

When the dialog is not opened, the page updates on save of the less.files.

jmezach commented 7 years ago

This is the exception we're getting when the dialog is open:

bluebird.js:1542 Unhandled rejection TypeError: Cannot read property 'lock' of undefined
    at UxDialogHeader.vendor_e20e2e25994cf48c7588../node_modules/aurelia-dialog/dist/native-modules/ux-dialog-header.js.UxDialogHeader.bind (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:7525:61)
    at View.bind (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:20319:22)
    at Controller.bind (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:22313:17)
    at View.bind (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:20325:22)
    at rerenderController (http://localhost:9000/scheduling.bundle.js:17289:17)
    at http://localhost:9000/scheduling.bundle.js:17042:187
    at Set.forEach (native)
    at HmrContext.<anonymous> (http://localhost:9000/scheduling.bundle.js:17042:61)
    at step (http://localhost:9000/scheduling.bundle.js:16857:23)
    at Object.next (http://localhost:9000/scheduling.bundle.js:16838:53)
    at fulfilled (http://localhost:9000/scheduling.bundle.js:16829:58)
    at tryCatcher (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:30853:23)
    at Promise._settlePromiseFromHandler (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:28875:31)
    at Promise._settlePromise (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:28932:18)
    at Promise._settlePromise0 (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:28977:10)
    at Promise._settlePromises (http://localhost:9000/node_modules/@rrwfm/rr/dist/vendor.bundle.js:29056:18)
StrahilKazlachev commented 7 years ago

This is the only place where there is lock. Which means .settings is undefined - either it is not passed to the constructor or someone is messing up the DialogController. Those who know how Webpack Hot Module Replacement works should check how it works with the DI and what are the implications, if any, of using Container.prototype.invoke.

StrahilKazlachev commented 7 years ago

@jods4 @niieani any help will be appreciated.

jods4 commented 7 years ago

@niieani is the brain behind HMR really, I am not too familiar with how it works sorry.