Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Weird behaviour with Angular #74

Closed
maxrimue opened this issue Nov 30, 2015 · 20 comments
Closed

Weird behaviour with Angular #74

maxrimue opened this issue Nov 30, 2015 · 20 comments

Comments

@maxrimue
Copy link

I've been encountering a weird problem. I've written a little Angular + Material Design script that does some animations here and there. When I run that script in Firefox, Chrome and Safari, everything works. Even when I compile an Electron app with the Angular Script using electron-packager, or run it in a prebuilt provided on GitHub Releases page for Electron, it works. However, if I install electron-prebuilt from npm and run the script with it, it shows weird behaviour. For example, a dialog opens correctly, but takes really long to close, and after that, the interface remains unusable for some time, it's as if Angular is waiting and blocking interaction.

Here's a video showing the behaviour in Chrome:
https://drive.google.com/file/d/0B3S33WrzEUwMV3ladTFkc1RIYWc/view?usp=sharing

And here's one showing it in Electron using electron-prebuilt:
https://drive.google.com/file/d/0B3S33WrzEUwMZnREdHJiUE0wV1k/view?usp=sharing

The script is the exact same, it does not have bugs, and several electron-prebuilt versions were tested, all behave the exact same. OS is El Capitan, computer is MacBook Pro 13" early 15, most recent versions of Chrome, electron-prebuilt and Angular + Dependencies were used.

@max-mapper
Copy link
Contributor

Hmm very weird. Only thing I can think of is that maybe disable-renderer-backgrounding is being enabled for some reason. It's the power saving feature that background chrome tabs use and it limits executions peed. Maybe try disabling it and see if that fixes the issue? e.g. https://github.com/maxogden/screencat/blob/bbde6e65ba960a34751f36eeb1ed4dc7ad6d3295/electron.js#L20

@maxrimue
Copy link
Author

I just tried it, but it doesn't change anything, and even if it did, it would be weird that it's only needed in this prebuilt right? Something I did notice though is that this seems to be only happening on my machine, on an iMac (El Capitan too) this does not happen, and electron-prebuilt does its job. I already thought it could be related to broken npm packages, but I removed everything and installed everything again, no change.

@max-mapper
Copy link
Contributor

The only difference between running your app with electron-packager vs electron-prebuilt is that prebuilt spawns the electron process from the command line, and packager runs it using a mac application. There will be some differences such as your PATH and process.cwd(). If you look at path.txt (which is autogenerated at install time) you can see exactly what electron binary is being spawned:

If you can reproduce this by running electron yourself from the CLI then its probably some weird electron bug

@maxrimue
Copy link
Author

I opened electron-prebuilts Electron executable using the CLI, and its the exact same behaviour. Again, if I download the prebuilt from the releases page and open it from the CLI (the exact same way), it does work. However, I noticed that if I copy the Electron.app from electron-prebuilt to somewhere else, like my Downloads folder, it does not show this behaviour, so it seems like it makes a difference in where it runs.

@max-mapper
Copy link
Contributor

@maxrimue can you try one last thing:

  1. download the prebuilt from the releases page, unzip it somewhere, and run the electron executable inside from the command line?
  2. run the electron executable that electron-prebuilt downloaded and unzipped

im curious if theres a difference between 1 and 2 (it might be related to how i'm unzipping in electron-prebuilt)

@maxrimue
Copy link
Author

Well, no. Both behave weird now. Another Electron.app prebuilt I downloaded and placed in /Applications works though, and zips I download always get unzipped by Safari when downloading, so it's not the zipping that's not working, as two prebuilts that behave differently were unzipped the same way.

@Shigawire
Copy link

Got exactly the same problem here. Initially I thought my code was bad, but I also tried the angular-material demo app (material-start) and it behaves just as silly in electron.

As soon as I start electron from the CLI, there is some strange behaviour. But if I drag and drop my project folder into the Electron window, the app is fine.

EDIT: Did you try running "electron my-app" from outside the project folder (Not like "electron ."). This seems to fix my problems.

@maxrimue
Copy link
Author

@Shigawire While your problem does sound the same, I cannot fix mine with your solution, perhaps these are just different results of the same bug? Can you provide some information what software you use, like which prebuilt and which OS?

@Shigawire
Copy link

@maxrimue Sorry for the late reply. I am running OSX 10.11.1, Electron Prebuilt 0.36.2.
Still, after working on the project several hours per day the only fix is to drag and drop the entire project folder into the electron version from the release page.

@JD10NN3
Copy link

JD10NN3 commented Jan 31, 2016

I'm having the exact issue.
with angular-material 1.0.4 and electron prebuilt v0.35.4.
running on osx 10.11.2.

I simply use this project and added a button to open a dialog on it : http://develephant.github.io/Amy/

@alfrescian
Copy link

Hi, I'm having the same issue. It's not reproducable:

  • in Chrome or any other recent browser.
  • when the app is built using electron-packager
  • when using electron-prebuilt on windows (win10)
  • when ngAnimate is removed from the app

it only occurs when using electron-prebuilt on osx (10.11.3) - it's also the same for electron-prebuilt 0.36.11 & 0.37.2.
just for info: my dep list (same for osx & win):

  • npm 3.7.12
  • node 5.9.1
  • ajax-request@1.2.1
  • del@2.2.0
  • electron-packager@5.2.1
  • electron-prebuilt@0.36.12
  • electron-windows-installer@1.2.5
  • gulp@3.9.1
  • lodash@3.10.1
  • mime@1.3.4
  • minimist@1.2.0
  • mkdirp@0.5.1

@lincolnwan
Copy link

I believe this bug has been solved with electron-prebuilt 1.1.1

@maxrimue
Copy link
Author

maxrimue commented Jun 3, 2016

@lincolnwan Unfortunately, this bug is still present in electron-prebuilt@1.2.1 for me.

Here is an example electron app I've put together to test whether someone is affected by this bug:
https://github.com/maxrimue/electron-prebuilt-bug

@lincolnwan
Copy link

@maxrimue maybe my guess was too naive.. I used to be affected by this bug but just suddenly everything runs smooth, no mater on 1.1.1 or 1.2.1. I have no idea what did the magic that fixed it.

@zeke
Copy link
Member

zeke commented Oct 7, 2016

Tool Version
MacOS 10.11.6
Electron 1.4.3
Node 6.4.0

I just tried out @lincolnwan's repo and was unable to reproduce the issue. See a short video here: https://cloudup.com/cc1zgZanP8V

I suspect this was fixed in a recent version of Electron or its Chromium dependency. Gonna close this out, but if anyone is still having problems, feel free to comment.

@zeke zeke closed this as completed Oct 7, 2016
@maxrimue
Copy link
Author

maxrimue commented Oct 9, 2016

@zeke Unfortunately, I'm still having this problem. I too created a demo repo to test for this here, it uses the most current Electron and Angular 1 deps and for me still shows the weird behaviour. It doesn't however surprise me that it didn't occur for you, it always seemed like something that would only appear on a few machines.

@zeke zeke reopened this Oct 9, 2016
@kevinsawicki
Copy link
Contributor

@maxrimue so you only experience this issue when launching your app directly with electron-prebuilt but not when built with electron-packager?

For example, a dialog opens correctly, but takes really long to close, and after that, the interface remains unusable for some time, it's as if Angular is waiting and blocking interaction.

Are you able to capture a CPU profile in the dev tools and see what is happening during this lag?

@maxrimue
Copy link
Author

maxrimue commented Dec 28, 2016

@kevinsawicki Exactly. I also just went ahead and upgraded Electron and Angular1 in my aforementioned demo repository and this problem still occurs. I captured a CPU profile using the DevTools and it seems like the "gap" in which nothing happens Electron is in "idle", at least that's what it says. You can find the profile here.

On the left, you can see the stack that opens the dialog and on the right the stack that closes it, in between mostly just "idle":
bildschirmfoto 2016-12-28 um 16 55 17

bildschirmfoto 2016-12-28 um 16 55 36

@gimox
Copy link

gimox commented Mar 30, 2017

+1 same problem with angular and angular material and dialog. It's fine in the build version.

@zeke
Copy link
Member

zeke commented Aug 8, 2017

The electron-prebuilt repo is being retired and its code has been moved into the electron/electron repo. For the sake of historical transparency, we will leave GitHub Issues enabled on this repository, but if you are still affected by the issue reported here, please open a new issue on electron/electron repo and reference this issue from it so people can get the full context. The electron repository has a large and active contributor community, so your issue is more likely to get the attention it deserves there. Thanks!

@zeke zeke closed this as completed Aug 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants