Skip to content

Commit

Permalink
fix(whiteboard): don't set state when not writable (#1607)
Browse files Browse the repository at this point in the history
- errorTips: improve error log
  • Loading branch information
hyrious committed Jul 14, 2022
1 parent 5bee5af commit cb6becb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions desktop/renderer-app/src/components/Tips/ErrorTips.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { message } from "antd";
import { ServerRequestError } from "../../utils/error/server-request-error";
import { NODE_ENV } from "../../constants/process";
import { i18n } from "../../utils/i18n";

export const errorTips = (e: unknown): void => {
if (NODE_ENV === "development") {
if (process.env.NODE_ENV === "development") {
console.error(e);
}

Expand Down
3 changes: 3 additions & 0 deletions desktop/renderer-app/src/stores/whiteboard-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ export class WhiteboardStore {
if (!room || !windowManager) {
return;
}
if (!room.isWritable) {
return;
}
if (!room.state.globalState || !(room.state.globalState as any).scrollToTop) {
room.setGlobalState({ scrollToTop: true });
windowManager.moveCamera({ centerY: -950, animationMode: AnimationMode.Immediately });
Expand Down
3 changes: 1 addition & 2 deletions web/flat-web/src/components/Tips/ErrorTips.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { message } from "antd";
import { ServerRequestError } from "../../utils/error/server-request-error";
import { NODE_ENV } from "../../constants/process";
import { i18n } from "../../utils/i18n";

export const errorTips = (e: unknown): void => {
if (NODE_ENV === "development") {
if (process.env.NODE_ENV === "development") {
console.error(e);
}

Expand Down
3 changes: 3 additions & 0 deletions web/flat-web/src/stores/whiteboard-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ export class WhiteboardStore {
if (!room || !windowManager) {
return;
}
if (!room.isWritable) {
return;
}
if (!room.state.globalState || !(room.state.globalState as any).scrollToTop) {
room.setGlobalState({ scrollToTop: true });
windowManager.moveCamera({ centerY: -950, animationMode: AnimationMode.Immediately });
Expand Down

0 comments on commit cb6becb

Please sign in to comment.