From e8698d18acc43479bd9fbf84723dc46fafc5e5cd Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 19 May 2025 20:32:21 +0100 Subject: [PATCH] Revert "DEV: Make outletArgs available as regular arguments in PluginOutlet (#32742)" This reverts commit 707a91243c35ea1693b80249e1c00fb5320f47cb. This is causing some unexpected re-rendering. Reverting while we investigate --- .../app/components/plugin-outlet.gjs | 38 +-------- .../services/deprecation-warning-handler.js | 1 - .../plugin-outlet-debug/args-table.gjs | 4 +- .../components/plugin-outlet-test.gjs | 78 ------------------- 4 files changed, 5 insertions(+), 116 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/plugin-outlet.gjs b/app/assets/javascripts/discourse/app/components/plugin-outlet.gjs index a47b5f1bff319..ea2b3ec134264 100644 --- a/app/assets/javascripts/discourse/app/components/plugin-outlet.gjs +++ b/app/assets/javascripts/discourse/app/components/plugin-outlet.gjs @@ -1,11 +1,9 @@ import Component from "@glimmer/component"; import { cached } from "@glimmer/tracking"; -import ClassicComponent from "@ember/component"; import { concat } from "@ember/helper"; import { get } from "@ember/object"; import { getOwner } from "@ember/owner"; import { service } from "@ember/service"; -import curryComponent from "ember-curry-component"; import { or } from "truth-helpers"; import PluginConnector from "discourse/components/plugin-connector"; import PluginOutlet from "discourse/components/plugin-outlet"; @@ -126,29 +124,6 @@ export default class PluginOutletComponent extends Component { ); } - @bind - safeCurryComponent(component, args) { - if (component.prototype instanceof ClassicComponent) { - for (const arg of Object.keys(args)) { - if (component.prototype.hasOwnProperty(arg)) { - deprecated( - `Unable to set @${arg} on connector for ${this.args.name}, because a property on the component class clashes with the argument name. Resolve the clash, or convert to a glimmer component.`, - { - id: "discourse.plugin-outlet-classic-args-clash", - } - ); - - // Build a clone of `args`, without the offending key, while preserving getters - const descriptors = Object.getOwnPropertyDescriptors(args); - delete descriptors[arg]; - args = Object.defineProperties({}, descriptors); - } - } - } - - return curryComponent(component, args, getOwner(this)); - } - - ); - - await render( - - ); - assert.dom(".glimmer-test").hasText("Hello world from glimmer"); - }); - - test("makes arguments available at top level in classic components", async function (assert) { - extraConnectorComponent( - "test-name", - class extends ClassicComponent { - - } - ); - - await render( - - ); - assert.dom(".classic-test").hasText("Hello world from classic"); - }); - - test("guards against name clashes in classic components", async function (assert) { - extraConnectorComponent( - "test-name", - class extends ClassicComponent { - get arg1() { - return "overridden"; - } - - - } - ); - - await withSilencedDeprecationsAsync( - "discourse.plugin-outlet-classic-args-clash", - async () => { - await render( - - ); - } - ); - assert.dom(".classic-test").hasText("overridden from classic"); - }); - } -); - module( "Integration | Component | plugin-outlet | whitespace", function (hooks) {