Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions packages/ember/addon/instance-initializers/sentry-performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ApplicationInstance from '@ember/application/instance';
import Ember from 'ember';
import { run, _backburner, scheduleOnce } from '@ember/runloop';
import * as Sentry from '@sentry/browser';
import { ExtendedBackburner } from "@sentry/ember/runloop";
import { Span, Transaction, Integration } from '@sentry/types';
import { EmberRunQueues } from '@ember/runloop/-private/types';
import { getActiveTransaction } from '..';
Expand All @@ -28,11 +29,19 @@ export function initialize(appInstance: ApplicationInstance): void {
}
}

function getBackburner() {
function getBackburner(): Pick<ExtendedBackburner, "on" | "off"> {
if (_backburner) {
return _backburner;
}

if (run.backburner) {
return run.backburner;
}
return _backburner;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change not all code paths here will return a value - so getBackburner() might return undefined now. Can we get around this somehow? Or do we have to do larger refactors for the usage of the getBackburner function?

This is why https://github.com/getsentry/sentry-javascript/runs/5235458452?check_suite_focus=true is failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I am not knowledgable enough in the history of Ember, but I believe that if _backburner does not exist, it means we are on an older version of Ember and thus run.backburner exists. We could thus remove the condition around run.backburner.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k-fish may be able to help us here


return {
on() {},
off() {}
}
}

function getTransitionInformation(transition: any, router: any) {
Expand Down