ember-fastboot / ember-fastboot/ember-cli-fastboot
Router.map leaks if invoked during the lifecycle of an Application Instance
- Dominant language
- JavaScript
- Stars
- 850
- Forks
- 161
- Avg merge
- 17h 45m
- Merged PRs (30d)
- 19
Description
Prior to FastBoot, this bug wasn't obvious.
The callback passed into `Router.map` ultimately ends up on an array: `EmberRouter.constructor.dslCallbacks`. They are then enumerated over at runtime and called when the router is initialized (per app instance). So, each request ends up pushing a new closure function that never gets cleaned up and invoked in subsequent requests.
The traditional way of defining routes, upfront and once, does not have this issue. It's only if you begin to register routes at any point during the app instance (for example, within an instance-initializer).
Cross-referencing for more details: https://github.com/emberjs/ember.js/issues/13840
Contributor guide
Assessment
This issue has not been assessed yet.