Is there an official documentation of Reload._onMigrate()?


#1

Here’s my scenario: In a mobile app I want to defer any hot code push until the user has accepted it via a Bootstrap modal dialog. This is also to get a bit more control about HCP, since it tends to break the whole app. (I already tried the safe-reload package, but this did not work reliably either.) My theory is: If the user at least knows that an update had happened, he/she is not completely irritated if the app is broken afterwards :slight_smile: (yeah, I know that’s not optimal and I am glad Martijn is improving this for 1.3).

I already know about Reload._onMigrate() and that I can defer HCP by returning false. But I don’t know about all the details and possible ways of intercepting and re-enabling the HCP.

Does anybody know where to find more information about this, or maybe even some code samples where the user is asked for confirmation? Thanks.


Disable hot code push on mobile
Some scaling lessons I've learned growing to 120k+ users
#2

Reload._onMigrate() is a private API that other packages use to register their interest in participating in a reload. That means they can pass on data to migrate to the new version, but they can also delay the reload until they are ready. It can also be used to disable automatic reloads, by simply returning [false] and never calling the retry callback.

For an example of delaying a reload and controlling when it happens, see the reload-on-resume package:

Note that this only affects when a reload happens. For Cordova, it is only called after HCP has already downloaded the new version. So if the app gets killed an restarts, it will always use the new version immediately and there will be no opportunity to warn the user.


Live Reload: Is there a hook or variable
Pagination filters reset on page reload
#3

OK, thanks for this additional info. I have to implement my own reload behaviour anyways, because I also need to be able to defer it in the web-browser (I’m using video streaming and want to avoid that this is interrupted).