mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 04:33:47 +08:00
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 da5db714c2
, 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.
This commit is contained in:
parent
0b9ad5425c
commit
8a451e0bfc
|
@ -179,10 +179,14 @@ export default class Application {
|
||||||
this.initialRoute = window.location.href;
|
this.initialRoute = window.location.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This entire system needs a do-over for v2
|
||||||
bootExtensions(extensions) {
|
bootExtensions(extensions) {
|
||||||
Object.keys(extensions).forEach((name) => {
|
Object.keys(extensions).forEach((name) => {
|
||||||
const extension = extensions[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);
|
const extenders = extension.extend.flat(Infinity);
|
||||||
|
|
||||||
for (const extender of extenders) {
|
for (const extender of extenders) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user