Skip to content

Commit

Permalink
fix: passing lazy loaded module to app.current.matches(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Nov 22, 2024
1 parent 70158aa commit 70081a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion framework/core/js/src/common/states/PageState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 70081a2

Please sign in to comment.