Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Add ability to reload without restarting app #26

Closed
lorensr opened this issue Dec 8, 2014 · 13 comments
Closed

[FR] Add ability to reload without restarting app #26

lorensr opened this issue Dec 8, 2014 · 13 comments

Comments

@lorensr
Copy link
Contributor

lorensr commented Dec 8, 2014

Can be used to display a message to the user that says "new version available, restart the app to update."

It would be nice to be able to display a message, "New version available, click here to update", and then the in-app browser refreshes to the new version, especially since many users don't know how to restart apps. Could a Reload.update() function be added?

@stubailo stubailo closed this as completed Dec 8, 2014
@stubailo stubailo reopened this Dec 8, 2014
@stubailo
Copy link
Contributor

stubailo commented Dec 8, 2014

Have you tried window.location.reload()? That might do what you want, I think.

@Slava
Copy link

Slava commented Dec 8, 2014

I think location.reload would not do that, as it reloads to meteor.local and doesn't restart the on-device server.

@Slava
Copy link

Slava commented Dec 8, 2014

Oh wait, I am wrong. The Reload call happens after the new data was downloaded and server restarted (https://github.com/meteor/meteor/blob/devel/packages/autoupdate/autoupdate_cordova.js). location.reload might do the trick :)

@lorensr
Copy link
Contributor Author

lorensr commented Dec 8, 2014

Works in the iOS simulator, thanks! Maybe add that as a possible use of Reload.isWaitingForResume() at the bottom of the readme?

@stubailo
Copy link
Contributor

stubailo commented Dec 8, 2014

Great idea, just added that. Thanks!

@stubailo stubailo closed this as completed Dec 8, 2014
@boustanihani
Copy link

Is there a meteor package similar to https://atmospherejs.com/mdg/reload-on-resume but for desktop clients? I mean a package that changes the behavior of Meteor's hot code push feature and allows us to attache custom code and define what happens when a new version is downloaded or detected.

I think doing a full page reload (for example by calling window.location.reload()) eliminates the risk of getting some invalid app state and the need to manually reset any variables or components. IMO it is not a big deal if a user needs to refill some form when this happens.

@stubailo
Copy link
Contributor

The way hot code push is implemented currently actually does do a full page reload for exactly this reason. You can attach hooks to reload related events via the reload package, but I don't think the API is well documented. Look at the source code of this package for an example of how to use it.

@boustanihani
Copy link

@stubailo Thanks, good to know :)

You mean I should take a look at this package ? =>
https://github.com/meteor/meteor/tree/devel/packages/reload

@stubailo
Copy link
Contributor

That would also be helpful, but I meant the mdg:reload-on-resume package, since it uses the reload API.

@boustanihani
Copy link

Okay :) I'll take a look.. THX

@sasikanth513
Copy link

If we use window.location.reload() connection to the server is lost and we are getting

Server sent add for existing id: 5JHx7YWauQobBXC7H error

but that record is not existed after the reload.

Is there any smooth way to do this like Reload.update()?

My code

function initializeUpdate(){
      document.addEventListener('resume', function(){
        if(Reload.isWaitingForResume()){
          window.location.reload();
        }
      }, false);
  }
  document.addEventListener("deviceready", initializeUpdate, false);

@sasikanth513
Copy link

This is more of grounddb issue I think
Meteor-Community-Packages/ground-db#22

@mitiaptest
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants