fix(frontend/player): codefix
This commit is contained in:
parent
cecd57fc50
commit
18a09cf66b
4 changed files with 51 additions and 51 deletions
|
|
@ -426,7 +426,7 @@ export default class MessageDistributor extends StatedScreen {
|
|||
this.performanceTrackManager.setCurrentNodesCount(this.windowNodeCounter.count);
|
||||
break;
|
||||
}
|
||||
this.pagesManager.append(msg);
|
||||
this.pagesManager.appendMessage(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export default class PagesManager extends ListWalker<DOMManager> {
|
|||
/*
|
||||
Assumed that messages added in a correct time sequence.
|
||||
*/
|
||||
add(m: Message): void {
|
||||
appendMessage(m: Message): void {
|
||||
if (m.tp === "create_document") {
|
||||
super.append(new DOMManager(this.screen, this.isMobile, m.time))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +1,53 @@
|
|||
import { applyChange, revertChange } from 'deep-diff';
|
||||
import ListWalker from './ListWalker';
|
||||
import type { Redux } from '../messages';
|
||||
// import { applyChange, revertChange } from 'deep-diff';
|
||||
// import ListWalker from './ListWalker';
|
||||
// import type { Redux } from '../messages';
|
||||
|
||||
export default class ReduxStateManager extends ListWalker<Redux> {
|
||||
private state: Object = {}
|
||||
private finalStates: Object[] = []
|
||||
// export default class ReduxStateManager extends ListWalker<Redux> {
|
||||
// private state: Object = {}
|
||||
// private finalStates: Object[] = []
|
||||
|
||||
moveWasUpdated(time, index) {
|
||||
super.moveApply(
|
||||
time,
|
||||
this.onIncrement,
|
||||
this.onDecrement,
|
||||
)
|
||||
}
|
||||
// moveWasUpdated(time, index) {
|
||||
// super.moveApply(
|
||||
// time,
|
||||
// this.onIncrement,
|
||||
// this.onDecrement,
|
||||
// )
|
||||
// }
|
||||
|
||||
onIncrement = (item) => {
|
||||
this.processRedux(item, true);
|
||||
}
|
||||
// onIncrement = (item) => {
|
||||
// this.processRedux(item, true);
|
||||
// }
|
||||
|
||||
onDecrement = (item) => {
|
||||
this.processRedux(item, false);
|
||||
}
|
||||
// onDecrement = (item) => {
|
||||
// this.processRedux(item, false);
|
||||
// }
|
||||
|
||||
private processRedux(action, forward) {
|
||||
if (forward) {
|
||||
if (!!action.state) {
|
||||
this.finalStates.push(this.state);
|
||||
this.state = JSON.parse(JSON.stringify(action.state)); // Deep clone :(
|
||||
} else {
|
||||
action.diff.forEach(d => {
|
||||
try {
|
||||
applyChange(this.state, d);
|
||||
} catch (e) {
|
||||
//console.warn("Deepdiff error")
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!!action.state) {
|
||||
this.state = this.finalStates.pop();
|
||||
} else {
|
||||
action.diff.forEach(d => {
|
||||
try {
|
||||
revertChange(this.state, 1, d); // bad lib :( TODO: write our own diff
|
||||
} catch (e) {
|
||||
//console.warn("Deepdiff error")
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// private processRedux(action, forward) {
|
||||
// if (forward) {
|
||||
// if (!!action.state) {
|
||||
// this.finalStates.push(this.state);
|
||||
// this.state = JSON.parse(JSON.stringify(action.state)); // Deep clone :(
|
||||
// } else {
|
||||
// action.diff.forEach(d => {
|
||||
// try {
|
||||
// applyChange(this.state, d);
|
||||
// } catch (e) {
|
||||
// //console.warn("Deepdiff error")
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// if (!!action.state) {
|
||||
// this.state = this.finalStates.pop();
|
||||
// } else {
|
||||
// action.diff.forEach(d => {
|
||||
// try {
|
||||
// revertChange(this.state, 1, d); // bad lib :( TODO: write our own diff
|
||||
// } catch (e) {
|
||||
// //console.warn("Deepdiff error")
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
"mobx-react-lite": "^3.1.6",
|
||||
"moment": "^2.29.2",
|
||||
"moment-range": "^4.0.2",
|
||||
"peerjs": "^1.3.2",
|
||||
"peerjs": "1.3.2",
|
||||
"rc-time-picker": "^3.7.3",
|
||||
"react": "^16.13.1",
|
||||
"react-circular-progressbar": "^2.0.3",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue