Skip to content

Commit

Permalink
Add FastBoot guard to LinkComponent's EventDispatcher lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Oct 25, 2020
1 parent 655cb2e commit 6d66813
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/@ember/-internals/glimmer/lib/components/link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { inject as injectService } from '@ember/service';
import { DEBUG } from '@glimmer/env';
import EmberComponent, { HAS_BLOCK } from '../component';
import layout from '../templates/link-to';
import { EmberVMEnvironment } from '../environment';

/**
The `LinkTo` component renders a link to the supplied `routeName` passing an optionally
Expand Down Expand Up @@ -494,9 +495,12 @@ const LinkComponent = EmberComponent.extend({

// As our EventDispatcher adds event listeners lazily, and does not recognize the dynamic event pattern here,
// we must tell it explicitly that we need to listen to `eventName` events
let eventDispatcher = getOwner(this).lookup<EventDispatcher>('event_dispatcher:main');
if (eventDispatcher) {
eventDispatcher.setupHandlerForEmberEvent(eventName);
let owner = getOwner(this);
if (owner.lookup<EmberVMEnvironment>('-environment:main')!.isInteractive) {
let eventDispatcher = owner.lookup<EventDispatcher>('event_dispatcher:main');
if (eventDispatcher) {
eventDispatcher.setupHandlerForEmberEvent(eventName);
}
}
},

Expand Down

0 comments on commit 6d66813

Please sign in to comment.