Widdershin / cycle-restart

Swap out the code in your Cycle.js apps on the fly!
MIT License
123 stars 11 forks source link

DOM driver not restarted correctly when using isolate #72

Open martinpengellyphillips opened 5 years ago

martinpengellyphillips commented 5 years ago

Just started using Cycle.JS and cycle-restart so the following may be just my ignorance :)

When using isolate in an app, no changes to the DOM code are loaded visibly by cycle-restart. If isolate is not used then the issue does not occur and updates to the code are reflected visibly after restart.

Digging into the code it seems that restartable explicitly does not wrap isolate methods (though I couldn't find the rationale for this in source / commit history).

Meanwhile, the isolateSource method on the DOM driver (v22.3.0) returns a brand new object. This new object is therefore never wrapped and its stream of events not recorded by cycle-restart for replay later.

Commenting out the logic in cycle-restart that excludes wrapping isolate functions solves the issue with no noticable side-effects:

// typeof name === 'string' && name.indexOf('isolate') !== -1 
Widdershin commented 5 years ago

I can't remember the original rationale for not wrapping isolate methods so maybe it's no longer useful in any way. If you want to open up a pull request we can look at fixing this :)

Thanks for the issue