mirror of
https://github.com/flarum/core.git
synced 2025-08-13 03:44:32 +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
|
||||
* @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
|
||||
if (!subclassOf(this.type, type)) return false;
|
||||
|
||||
|
Reference in New Issue
Block a user