Give preference to name prop when initialData.appState.name is present and update specs

This commit is contained in:
Aakansha Doshi
2021-03-20 14:25:02 +05:30
parent 78024873e5
commit 16c287c848
2 changed files with 21 additions and 10 deletions
+5 -1
View File
@@ -525,7 +525,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
let zenModeEnabled = actionResult?.appState?.zenModeEnabled || false;
let gridSize = actionResult?.appState?.gridSize || null;
let theme = actionResult?.appState?.theme || "light";
const name = actionResult?.appState?.name || this.state.name;
let name = actionResult?.appState?.name || this.state.name;
if (typeof this.props.viewModeEnabled !== "undefined") {
viewModeEnabled = this.props.viewModeEnabled;
@@ -543,6 +543,10 @@ class App extends React.Component<ExcalidrawProps, AppState> {
theme = this.props.theme;
}
if (typeof this.props.name !== "undefined") {
name = this.props.name;
}
this.setState(
(state) => {
// using Object.assign instead of spread to fool TS 4.2.2+ into