From e335e316afdf6f8a7d7cd3117f346c945336ec1b Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Fri, 7 May 2021 12:29:10 -0400 Subject: [PATCH] Fix exception in `bootExtensions` Frontend extenders exist in a weird state of limbo, where they are technically defined, but aren't used or tested at all. In 114779bcfdaa34152bfb0dd13f0212c403f3155c, we shifted from passing `extension.extend` to `flattenDeep` to calling `flat` on `extension.extend`. If an extension doesn't define extenders (as is the case for most extensions), the change breaks the forum. All we do here is add a null check. --- framework/core/js/src/common/Application.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/core/js/src/common/Application.js b/framework/core/js/src/common/Application.js index 3f160bcbd..94e631cf2 100644 --- a/framework/core/js/src/common/Application.js +++ b/framework/core/js/src/common/Application.js @@ -179,10 +179,14 @@ export default class Application { this.initialRoute = window.location.href; } + // TODO: This entire system needs a do-over for v2 bootExtensions(extensions) { Object.keys(extensions).forEach((name) => { const extension = extensions[name]; + // If an extension doesn't define extenders, there's nothing more to do here. + if (!extension.extend) return; + const extenders = extension.extend.flat(Infinity); for (const extender of extenders) {