Skip to content

Commit

Permalink
fix(desktop): improve shareScreenStore isWritable
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHole1 committed Aug 26, 2021
1 parent dce8020 commit bd2a96b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions desktop/renderer-app/src/stores/ClassRoomStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { action, autorun, makeAutoObservable, observable, runInAction } from "mobx";
import { action, autorun, makeAutoObservable, observable, reaction, runInAction } from "mobx";
import { v4 as uuidv4 } from "uuid";
import dateSub from "date-fns/sub";
import { Rtc as RTCAPI, RtcChannelType } from "../apiMiddleware/Rtc";
Expand Down Expand Up @@ -164,9 +164,15 @@ export class ClassRoomStore {
}
});

runInAction(() => {
this.shareScreenStore.updateIsWritable(this.whiteboardStore.isWritable);
});
reaction(
() => this.whiteboardStore.isWritable,
() => {
this.shareScreenStore.updateIsWritable(this.whiteboardStore.isWritable);
},
{
fireImmediately: true,
},
);

this.rtm.once(RTMessageType.REMOTE_LOGIN, () => {
runInAction(() => {
Expand Down

0 comments on commit bd2a96b

Please sign in to comment.