Skip to content

Commit 94cef3b

Browse files
authored
Merge pull request matrix-org#6755 from matrix-org/gsouquet/fix-thread-creation
2 parents 9d1e6dc + 6c60e4c commit 94cef3b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/components/structures/ThreadView.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import dis from "../../dispatcher/dispatcher";
3232
import { ActionPayload } from '../../dispatcher/payloads';
3333
import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload';
3434
import { Action } from '../../dispatcher/actions';
35+
import { MatrixClientPeg } from '../../MatrixClientPeg';
3536

3637
interface IProps {
3738
room: Room;
@@ -89,12 +90,15 @@ export default class ThreadView extends React.Component<IProps, IState> {
8990
};
9091

9192
private setupThread = (mxEv: MatrixEvent) => {
92-
const thread = mxEv.getThread();
93-
if (thread) {
94-
thread.on("Thread.update", this.updateThread);
95-
thread.once("Thread.ready", this.updateThread);
96-
this.updateThread(thread);
93+
let thread = mxEv.getThread();
94+
if (!thread) {
95+
const client = MatrixClientPeg.get();
96+
thread = new Thread([mxEv], this.props.room, client);
97+
mxEv.setThread(thread);
9798
}
99+
thread.on("Thread.update", this.updateThread);
100+
thread.once("Thread.ready", this.updateThread);
101+
this.updateThread(thread);
98102
};
99103

100104
private teardownThread = () => {

0 commit comments

Comments
 (0)