Skip to content

Commit

Permalink
fix(desktop): creator exits room cause bug in homepage room list (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed May 28, 2021
1 parent cb910db commit a6dfae2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const RemoveHistoryRoomModal = observer<RemoveHistoryRoomModalProps>(
function RemoveHistoryRoomModal({ visible, onCancel, onConfirm, loading }) {
return (
<Modal
title={"删除房间记录"}
title="删除房间记录"
visible={visible}
onCancel={onCancel}
footer={[
Expand All @@ -24,6 +24,7 @@ export const RemoveHistoryRoomModal = observer<RemoveHistoryRoomModalProps>(
确定
</Button>,
]}
destroyOnClose
>
确定删除当前房间记录?
</Modal>
Expand Down
3 changes: 1 addition & 2 deletions desktop/renderer-app/src/pages/ReplayPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useEffect, useRef, useState } from "react";
import { RouteComponentProps, useParams, useHistory } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { LoadingPage } from "flat-components";
import { ErrorPage, LoadingPage } from "flat-components";
import PlayerController from "@netless/player-controller";
import { ipcAsyncByMainWindow, ipcReceive, ipcReceiveRemove } from "../../utils/ipc";
import { ErrorPage } from "flat-components";
import { RealtimePanel } from "../../components/RealtimePanel";
import { ChatPanelReplay } from "../../components/ChatPanelReplay";
import { OrdinaryRoomInfo } from "../../apiMiddleware/flatServer";
Expand Down
4 changes: 3 additions & 1 deletion desktop/renderer-app/src/stores/ClassRoomStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export class ClassRoomStore {
autorun(reaction => {
if (this.whiteboardStore.isKicked) {
reaction.dispose();
this.roomStatusOverride = RoomStatus.Stopped;
runInAction(() => {
this.roomStatusOverride = RoomStatus.Stopped;
});
}
});
}
Expand Down
13 changes: 11 additions & 2 deletions desktop/renderer-app/src/stores/WhiteboardStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeAutoObservable, observable } from "mobx";
import { makeAutoObservable, observable, runInAction } from "mobx";
import {
createPlugins,
DefaultHotKeys,
Expand Down Expand Up @@ -159,7 +159,16 @@ export class WhiteboardStore {
reason === "roomDelete" ||
reason === "roomBan"
) {
this.isKicked = true;
// Kick in-room joiners when creator cancels room
// from the homepage list menu
runInAction(() => {
// Room creator do not need to listen to this event
// as they are in control of exiting room.
// Listening to this may interrupt the stop room process.
if (!this.isCreator) {
this.isKicked = true;
}
});
}
},
},
Expand Down
1 change: 1 addition & 0 deletions packages/flat-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from "./components/ChatPanel";
export * from "./components/ClassroomPage";
export * from "./components/CloudStorage";
export * from "./components/EditRoomPage";
export * from "./components/ErrorPage";
export * from "./components/HomePage";
export * from "./components/InviteModal";
export * from "./components/LoadingPage";
Expand Down

0 comments on commit a6dfae2

Please sign in to comment.