Skip to content

Commit

Permalink
FIX: Correct getOwner import
Browse files Browse the repository at this point in the history
As it's currently implemented, the fallback is essential here. `this` in a static method is `undefined`, and therefore cannot have an owner.

Unfortunately this plugin outlet does not seem to be tested in the plugin's own test suite. Core's test suite picked up this issue.
  • Loading branch information
davidtaylorhq committed Oct 17, 2023
1 parent 3a0b46d commit 19707e0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import I18n from "I18n";
import { getOwner } from "@ember/application";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
Expand All @@ -17,7 +17,7 @@ const UX_VALUES = {

export default class SolvedStatusFilter extends Component {
static shouldRender(args, helper) {
const router = getOwner(this).lookup("service:router");
const router = getOwnerWithFallback(this).lookup("service:router");

if (
!helper.siteSettings.show_filter_by_solved_status ||
Expand Down

0 comments on commit 19707e0

Please sign in to comment.