Skip to content

Commit

Permalink
FIX: Correct getOwner import (#260)
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.

Followup to 3a0b46d
  • Loading branch information
davidtaylorhq committed Oct 17, 2023
1 parent 3a0b46d commit 56d936b
Showing 1 changed file with 2 additions and 2 deletions.
@@ -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 56d936b

Please sign in to comment.