FIX: replaces discourseComputed by computed (#16530)

This was causing unexpected behaviors on production builds. And also on firefox on local environnement, however the issues was slightly different.

- production chrome: colors don't load
- dev firefox: colors don't change when selecting a different color set
This commit is contained in:
Joffrey JAFFEUX 2022-04-21 21:56:08 +02:00 committed by GitHub
parent fc56bd36c9
commit 3daa45deaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -1,18 +1,19 @@
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import I18n from "I18n"; import I18n from "I18n";
import bootbox from "bootbox"; import bootbox from "bootbox";
import discourseComputed from "discourse-common/utils/decorators";
import { later } from "@ember/runloop"; import { later } from "@ember/runloop";
import { action } from "@ember/object"; import { action, computed } from "@ember/object";
import { clipboardCopy } from "discourse/lib/utilities"; import { clipboardCopy } from "discourse/lib/utilities";
export default class AdminCustomizeColorsShowController extends Controller { export default class AdminCustomizeColorsShowController extends Controller {
@discourseComputed("model.colors", "onlyOverridden") onlyOverridden = false;
colors(allColors, onlyOverridden) {
if (onlyOverridden) { @computed("model.colors.[]", "onlyOverridden")
return allColors.filterBy("overridden"); get colors() {
if (this.onlyOverridden) {
return this.model.colors?.filterBy("overridden");
} else { } else {
return allColors; return this.model.colors;
} }
} }