[SOLVED] - Disabling HCP feature

For some reasons, i have to disable meteor Hot Code Push(HCP) feature from my app.

My code-

Reload._onMigrate(“LiveUpdate”, function() {
return [false];
});

i put this code on clients/main.js file

is this the right way to disable HCP? is this safe to disabling HCP on a meteor app?

1 Like

Yup, this is one hell of an annoying feature that whenever you write to public it forces a reload and there’s no way to remove it unless you add the above code.

Although right now in 2022 you must use single quotes (atleast in my node build) so simply add:

Reload._onMigrate('LiveUpdate', function() {
return [false];
});

You will still see => Client modified -- refreshing in the console output although you now have got the behaviour of hitting refresh yourself.

It would be great if this was added to the documentation as a way to do this as I have been searching for the solution for 2 weeks now and stumbled upon it via stackoverflow and then searched for the method and found this thread. I was not able to find it through the forum search but it was in the search engine results, either way I now have the solution to fix this problem and I can finally finish up this part of my app… LETS GOOO

1 Like

Here’s code based on Reload package API this isn’t exactly what are you looking for, but should be useful as inspiration source

1 Like

Thanks man I’m good now with this little snippet - your code looks interesting though man, what’s the use case really for all this?

1 Like

@truedon when you use Cache in a ServiceWorker for HTTP traffic caching and management it’s easy to run into stale pieces of code. This piece of code will make sure all caches are purged upon HCP before reloading the page.

For example in the other open source app we use it to avoid unexpected page refresh and display user a message that they can refresh the page to get upgraded:

  1. Update value of ReactiveVar upon HCP
  2. Display message with various options
2 Likes

Dude this is perfection and should be in the official core! Thank you!!

2 Likes

@denyhs How can we add this into the core it’s goated af

3 Likes