Skip to content

Commit

Permalink
Fix exception in bootExtensions
Browse files Browse the repository at this point in the history
Frontend extenders exist in a weird state of limbo, where they are technically defined, but aren't used or tested at all. In da5db71, 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.
  • Loading branch information
askvortsov1 committed May 7, 2021
1 parent 0b9ad54 commit 8a451e0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/src/common/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8a451e0

Please sign in to comment.