Skip to content

Allow for apps to disable page reload livesyncs #1517

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

Closed
hdeshev opened this issue Feb 19, 2016 · 9 comments
Closed

Allow for apps to disable page reload livesyncs #1517

hdeshev opened this issue Feb 19, 2016 · 9 comments
Assignees
Milestone

Comments

@hdeshev
Copy link
Contributor

hdeshev commented Feb 19, 2016

Why

Page reload syncs are completely unsupported in Angular apps, and realoading a page completely breaks the app.

What

We need a way to disable page reload syncs for Angular apps, and always restart the app.

How

Certainly not like this. Funny hacks aside, here's what comes to mind:

  • We can check package.json for an angular2 dependency.
  • We can introduce a CLI option like --no-page-reloads
  • We can expose additional hooks in some module that the nativescript-angular code overrides and disables page reloads.
@rosen-vladimirov
Copy link
Contributor

I would suggest an option in package.json (of course under nativescript key), so you can just define that you always want restart for the current project.

@atanasovg
Copy link
Contributor

Ping @rosen-vladimirov @ligaz This is critical for our Angular integration.

@rosen-vladimirov rosen-vladimirov self-assigned this Mar 17, 2016
@rosen-vladimirov
Copy link
Contributor

@atanasovg , @hdeshev
Do you like the idea for having separate key in project's package.json, for example:

"nativescript": { 
    "reloadOnSync": false,
    "tns-android": "1.7.0"
}

We can add it by default in our Angular template and I'll make sure CLI will copy it to project's package.json when this template is used.
This way user's will not have to pass additional option to tns livesync command.
What do you think?

@hdeshev
Copy link
Contributor Author

hdeshev commented Mar 17, 2016

I like it. Do we need to copy it in the CLI if it's present in the template already?

Just to clarify, setting reloadOnSync to false means the app will get restarted just as if we have a change to a *.ts file, right?

@rosen-vladimirov
Copy link
Contributor

@hdeshev yes, I've not been very creative with the name 😸
Maybe we can name it disableFastSync or refreshOnSync?

As per the copying from template to project's package.json - yes, CLI works with the project, not with the template's package.json. The only case where we check the template's package.json is on tns create - CLI reads it and copies information from it to the project.

@ligaz
Copy link

ligaz commented Mar 18, 2016

Isn't this responsibility of the nativescript-angular package? Imagine that in a bright future we enable fast LiveSync for Angular apps. This will require every project's package.json to be updated in order to take advantage of it, instead of just updating the nativescript-angular dependency.

I'm imagining we provide the right hook (similar to the way we want transpilers to define which files to ignore for sync) so that the nativescript-angular disables the fast LiveSync.

@hdeshev
Copy link
Contributor Author

hdeshev commented Mar 21, 2016

👍 I like the idea of calling a callback which we can override in a plugin. That would probably require a change to tns-core-modules (which is probably OK).

@TsvetanMilanov
Copy link
Contributor

Livesync hook and a way to force full livesync are added. This plugin shows how to do it. With this hook when changing any type of file full sync will be executed.

@rosen-vladimirov rosen-vladimirov added this to the 2.1 (Under consideration) milestone May 26, 2016
@enchev enchev closed this as completed Jun 6, 2016
@enchev
Copy link
Contributor

enchev commented Jun 9, 2016

Already done.

@enchev enchev added the feature label Jun 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants