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

Issue with link-to helper causing page freezes #10360

Closed
ggrillone opened this issue Feb 4, 2015 · 12 comments · Fixed by #10553
Closed

Issue with link-to helper causing page freezes #10360

ggrillone opened this issue Feb 4, 2015 · 12 comments · Fixed by #10553

Comments

@ggrillone
Copy link

Ember version: 1.9

So I recently encountered an issue where rendering a particular view was causing the browser to slow down and eventually freeze.

After a bit of digging the culprit turned out to be the following line:

{{link-to modelAttr 'someRoute' }}

In some cases we expected modelAttr to be null, which turned out to be the root cause of what triggered the browser freeze.

I couldn't find anything in the docs to explain how link-to would handle null.

In the UI, it would just render an empty string which is what I expected, but find it strange that it would cause the browser to freeze.

To give some more context. On the left-hand side of the page we have a navigation panel which lists all models in a collection. And by clicking on each it links to the show action for that resource. The issue doesn't occur at first, but it seems to build up after clicking on links in the left-hand nav container.

Let me know if there is anymore info or code I can post here to help.

@stefanpenner
Copy link
Member

can you provide a demonstration of the issue, maybe a JSBIN or example app.

@pgasiorowski
Copy link

Shouldn't it be the other way around eg {{link-to 'someRoute' modelAttr}} ?

@ggrillone
Copy link
Author

@WooDzu good point. I had the same thought, but looking at the docs it looks like the following 2 ways of using link-to are supported:

{{link-to 'Edit this photo' 'photo.edit' photo class="btn btn-primary"}} http://emberjs.com/guides/templates/links/#toc_adding-additional-attributes-on-a-link

and

{{#link-to 'photo.comment' primaryComment}}Main Comment{{/link-to}}
http://emberjs.com/guides/templates/links/#toc_adding-additional-attributes-on-a-link

@stefanpenner I'll get that jsbin to you as soon as I can. might be a few days, have a big backlog at work to go through

@markprzepiora
Copy link

I'm not sure if this is related, but there's definitely some kind of weird regression related to the link-to helper in canary. The issue I'm experiencing is different from the OP's. Mine is that some (not random, but completely arbitrary) links do not cause active classes to be updated upon the transition like they should. So you click a link and it transitions successfully, but the old link remains highlighted.

I will try to either do a bisect or create a jsbin that shows the issue. But has anyone experienced something similar?

@omghax
Copy link
Contributor

omghax commented Feb 12, 2015

I'm seeing this as well in an app that I recently upgraded to 1.9. Specifically, I have a link whose text is bound to an input field. Typing more than a few characters into the field causes the browser to freeze. I've thrown together a quick JSBin to demonstrate the issue: http://emberjs.jsbin.com/lanayo/1/.

Edited: updated JSBin URL.

@omghax
Copy link
Contributor

omghax commented Feb 12, 2015

Downloaded the latest starter kit and it looks like this happens in 1.10 as well. It only seems to be a problem with the inline form of {{link-to}}. The block form works fine.

@tim-evans
Copy link
Contributor

This burned us bad on a deploy. Didn't see this until after I pushed. I'll make jsbins to show off the regression

@tim-evans
Copy link
Contributor

FYI the info for our app is:

Ember            1.11.0-beta.1+canary.26c1084c
Ember Data       1.0.0-beta.15-canary
jQuery           1.11.1

@stefanpenner
Copy link
Member

This burned us bad on a deploy. Didn't see this until after I pushed. I'll make jsbins to show off the regression

thanks

@ghedamat
Copy link
Contributor

Just stubled upon this myself

can confirm what @omghax mentioned, happens only with the inline form

here's a quick jsbin

http://emberjs.jsbin.com/vutagupico (edit: fixed link)

just press on the links a few times and you'll see it happening

looking at the "timeline" panel it can be seen that the more the link is clicked the more the time spent in jquery events increases and with that the heap size

I might have to step out now but I'll try to update the bin to canary later and investigate a bit more.

/cc @stefanpenner (thanks as usual :) )

@rwjblue
Copy link
Member

rwjblue commented Mar 1, 2015

Thank you for the reproduction, with it @mmun was able to track down the issue and help me with the solution: #10553.

The fix should land in 1.10.1.

@rwjblue rwjblue added this to the 1.10.1 milestone Mar 1, 2015
@ghedamat
Copy link
Contributor

ghedamat commented Mar 1, 2015

thank you @rwjblue and @mmun ! you're the best!

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

Successfully merging a pull request may close this issue.

9 participants