embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
330 stars 137 forks source link

Fix getRoute override #1904

Closed jembezmamy closed 3 weeks ago

jembezmamy commented 3 weeks ago

This PR aims at resolving #1455 - too much recursion error.

The error is caused by getRoute being overridden multiple times: every time setupRouter is called, we create a new layer of recursion. This happens e.g. when we render a link, which calls urlFor, which calls setupRouter. So while the user clicks around the app, getRoute is overridden again and again, which can lead to too much recursion error at some point.

The proposed resolution is to leverage isSetup to make sure the getRoute is extended only once.

ef4 commented 3 weeks ago

Thanks.

I retargeted to stable and slightly adjusted the implementation. Now GitHub isn't running the actions...