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

Minimized report causes JS error #300

Closed
mrakitin opened this issue Aug 18, 2016 · 10 comments
Closed

Minimized report causes JS error #300

mrakitin opened this issue Aug 18, 2016 · 10 comments
Assignees

Comments

@mrakitin
Copy link
Collaborator

Minimized report after maximizing causes this JS error both in the browser console and server log:

10.0.2.2 - - [18/Aug/2016 15:19:22] "POST /run-simulation HTTP/1.1" 200 -
../sirepo/server.py:199:app_error_logging 10.0.2.2: javascript error: {
    "cause": "",
    "message": "Error: [$rootScope:inprog] http://errors.angularjs.org/1.4.2/$rootScope/inprog?p0=%24digest",
    "stackTrace": [
        "J/<@http://localhost:8000/static/js/angular-1.4.2.min.js:6:416",
        "r@http://localhost:8000/static/js/angular-1.4.2.min.js:127:187",
        "jf/this.$get</n.prototype.$digest@http://localhost:8000/static/js/angular-1.4.2.min.js:131:374",
        ".linkPlot/</scope.windowResize<@http://localhost:8000/static/js/sirepo-plotting.js?20160818.151851:179:21",
        "debounce/</later@http://localhost:8000/static/js/sirepo-plotting.js?20160818.151851:26:17",
        "td/g.prototype.notify/<@http://localhost:8000/static/js/angular-1.4.2.min.js:123:1",
        "jf/this.$get</n.prototype.$eval@http://localhost:8000/static/js/angular-1.4.2.min.js:134:489",
        "jf/this.$get</n.prototype.$digest@http://localhost:8000/static/js/angular-1.4.2.min.js:132:1",
        "jf/this.$get</n.prototype.$apply@http://localhost:8000/static/js/angular-1.4.2.min.js:135:267",
        "e/p.$$intervalId<@http://localhost:8000/static/js/angular-1.4.2.min.js:96:315"
    ],
    "type": "exception",
    "url": "http://localhost:8000/srw#/beamline/3iRUqjkg?application_mode=wavefront"
}
10.0.2.2 - - [18/Aug/2016 15:19:23] "POST /error-logging HTTP/1.1" 200 -

It can be reproduced in any example, but I used Young's Double Slit Experiment example and minimized Intensity at W30 Report, 30m report, changed some parameters (e.g., sampling factor) to trigger recalculation of the reports and then maximized the minimized report.

@mrakitin mrakitin added this to the SRW - bugs milestone Aug 18, 2016
@mrakitin
Copy link
Collaborator Author

It even does not need recalculation, you just need to minimize/maximize a report.

@robnagler
Copy link
Member

robnagler commented Aug 18, 2016 via email

@moellep
Copy link
Member

moellep commented Aug 18, 2016

The $apply or $digest is needed or the reports don't resize with the page.
You need to run $digest because the event comes in from outside angular. If
it also gets called from within angular, you get the "digest in progress"
error. I'll debug it.

[image: Inline image 1]

On Thu, Aug 18, 2016 at 10:00 AM, Rob Nagler [email protected]
wrote:

I don't understand this change;

31f9c5a
617c99e3f4#diff-bd59f22ea95f9de04f76e1fe585c1e14R176

The $scope.apply was unnecessary so I removed it. I don't think you want to
run $digest explicitly.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#300 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGNwrpAVDpgxMQSUTdh8Prgl85jIb9hZks5qhIGlgaJpZM4Jnm45
.

@robnagler
Copy link
Member

robnagler commented Aug 18, 2016 via email

@moellep
Copy link
Member

moellep commented Aug 18, 2016

I reverted the debounce() back to setTimeout() / clearTimeout(). The change
to $interval also caused the callback to get lost for everything except the
last registered caller.

Paul

On Thu, Aug 18, 2016 at 11:39 AM, Rob Nagler [email protected]
wrote:

The event comes from angular, because I changed it to $interval.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#300 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGNwrhN596rsFRRc7A_rP3hDAG-8u7iNks5qhJi4gaJpZM4Jnm45
.

@robnagler
Copy link
Member

robnagler commented Aug 18, 2016 via email

@robnagler robnagler removed this from the SRW - bugs milestone Aug 18, 2016
@robnagler robnagler added the bug label Aug 18, 2016
@robnagler robnagler self-assigned this Aug 18, 2016
@robnagler
Copy link
Member

How is it supposed to work? I thought the function should only be called once no matter how many times debounce was called.

@moellep
Copy link
Member

moellep commented Aug 18, 2016

Each plot registers to get called back on a resize event. When the resize
happens, the windowResize gets called for that scope:

scope.windowResize = debounce(function() {
console.log('resize: ', scope.modelName);
scope.resize();
scope.$digest();
}, 250);

For some reason, the $interval code was only calling windowResize() for the
plot which registerred last, not all the plots.

Paul

On Thu, Aug 18, 2016 at 12:37 PM, Rob Nagler [email protected]
wrote:

How is it supposed to work? I thought the function should only be called
once no matter how many times debounce was called.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#300 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGNwrskf0d5Zw_1pv-muBpqBbBeUONb8ks5qhKZlgaJpZM4Jnm45
.

@robnagler
Copy link
Member

robnagler commented Aug 18, 2016 via email

robnagler pushed a commit that referenced this issue Aug 19, 2016
@robnagler
Copy link
Member

Fix 8e7b244

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

3 participants