Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ffee201

Browse files
committed
Add matrixClient to RoomContext
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 2b3acb2 commit ffee201

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/structures/RoomView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
20992099
const showChatEffects = SettingsStore.getValue('showChatEffects');
21002100

21012101
return (
2102-
<RoomContext.Provider value={this.state}>
2102+
<RoomContext.Provider value={{ matrixClient: this.context, ...this.state }}>
21032103
<main className={mainClasses} ref={this.roomView} onKeyDown={this.onReactKeyDown}>
21042104
{ showChatEffects && this.roomView.current &&
21052105
<EffectsOverlay roomWidth={this.roomView.current.offsetWidth} />

src/contexts/RoomContext.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import { createContext } from "react";
18+
import { MatrixClient } from "matrix-js-sdk/src/client";
1819

1920
import { IRoomState } from "../components/structures/RoomView";
2021
import { Layout } from "../settings/Layout";
@@ -27,7 +28,11 @@ export enum TimelineRenderingType {
2728
Notification = "Notification",
2829
}
2930

30-
const RoomContext = createContext<IRoomState>({
31+
export interface IRoomContext extends IRoomState {
32+
matrixClient: MatrixClient;
33+
}
34+
35+
const RoomContext = createContext<IRoomContext>({
3136
roomLoading: true,
3237
peekLoading: false,
3338
shouldPeek: true,
@@ -63,6 +68,7 @@ const RoomContext = createContext<IRoomState>({
6368
dragCounter: 0,
6469
timelineRenderingType: TimelineRenderingType.Room,
6570
liveTimeline: undefined,
71+
matrixClient: undefined,
6672
});
6773
RoomContext.displayName = "RoomContext";
6874
export default RoomContext;

0 commit comments

Comments
 (0)