Change module API to be an instance getter (#31025)

* Change module API to be an instance getter

Helps with circular dependencies by not instantating the module API
on the initial evaluation of the files.

* Add basic test

* add another test
This commit is contained in:
David Baker
2025-10-15 10:20:48 +01:00
committed by GitHub
parent 6cfe197a38
commit 146e4772ac
8 changed files with 82 additions and 23 deletions

View File

@@ -31,7 +31,7 @@ import { UIFeature } from "../../../settings/UIFeature";
import { ModuleRunner } from "../../../modules/ModuleRunner";
import { Icon as AskToJoinIcon } from "../../../../res/img/element-icons/ask-to-join.svg";
import Field from "../elements/Field";
import ModuleApi from "../../../modules/Api.ts";
import { ModuleApi } from "../../../modules/Api.ts";
const MemberEventHtmlReasonField = "io.element.html_reason";
@@ -750,7 +750,7 @@ class RoomPreviewBar extends React.Component<IProps, IState> {
}
const WrappedRoomPreviewBar = (props: IProps): JSX.Element => {
const moduleRenderer = ModuleApi.customComponents.roomPreviewBarRenderer;
const moduleRenderer = ModuleApi.instance.customComponents.roomPreviewBarRenderer;
if (moduleRenderer) {
return moduleRenderer(
{