From 68851b235c02987182f9caf095002329838e74c7 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 4 Jul 2022 15:47:44 -0400 Subject: [PATCH] Followup to "Detect addons with customized treeForMethod names" The bugfix in #1230 caused us to start detecting some very weird old addons as having customized trees, and we can't really do anything with those. It was better to give them the stock tree behaviors. --- packages/compat/src/v1-addon.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/compat/src/v1-addon.ts b/packages/compat/src/v1-addon.ts index bbe2ad510..85183137e 100644 --- a/packages/compat/src/v1-addon.ts +++ b/packages/compat/src/v1-addon.ts @@ -421,9 +421,14 @@ export default class V1Addon { } private customizesHookName(treeName: string): boolean { + if (!this.addonInstance.treeForMethods) { + // weird old addons don't even extend ember-cli's Addon base class and + // might not have this. + return false; + } for (let [name, methodName] of Object.entries(defaultMethods)) { if (methodName === treeName) { - return this.addonInstance.treeForMethods?.[name] !== methodName; + return this.addonInstance.treeForMethods[name] !== methodName; } } return false;