mirror of
https://github.com/flarum/core.git
synced 2025-08-16 13:24:11 +02:00
fix: passing lazy loaded module to app.current.matches(...)
This commit is contained in:
@@ -21,7 +21,15 @@ export default class PageState {
|
|||||||
* @param {Record<string, unknown>} data
|
* @param {Record<string, unknown>} data
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
matches(type: Function, data: any = {}) {
|
matches(type: Function | string, data: any = {}) {
|
||||||
|
if (typeof type === 'string') {
|
||||||
|
const [namespace, id] = flarum.reg.namespaceAndIdFromPath(type);
|
||||||
|
|
||||||
|
type = flarum.reg.checkModule(namespace, id);
|
||||||
|
|
||||||
|
if (!type) return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Fail early when the page is of a different type
|
// Fail early when the page is of a different type
|
||||||
if (!subclassOf(this.type, type)) return false;
|
if (!subclassOf(this.type, type)) return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user