fix construct img reloads

This commit is contained in:
ntr 2019-07-19 20:46:38 +10:00
parent 9f0c212643
commit 3f1367172d
4 changed files with 5 additions and 6 deletions

View File

@ -71,7 +71,6 @@ function createSocket(store) {
// set the game state so resolutions don't fire twice // set the game state so resolutions don't fire twice
store.dispatch(actions.setGame(game)); store.dispatch(actions.setGame(game));
ws.sendGameState(game.id);
return true; return true;
}); });
} }

View File

@ -70,10 +70,6 @@ class Sleep extends Component {
} }
componentDidMount() { componentDidMount() {
anime.set('#sleep', {
translateY: 75,
});
this.animations.push(anime({ this.animations.push(anime({
targets: ['#sleep'], targets: ['#sleep'],
opacity: [ opacity: [

View File

@ -113,6 +113,10 @@ class ConstructAvatar extends Component {
} }
shouldComponentUpdate({ animSource, animTarget, construct }) { shouldComponentUpdate({ animSource, animTarget, construct }) {
if (construct !== this.props.construct) {
return true;
}
if (animSource === this.props.animSource && animTarget === this.props.animTarget) { if (animSource === this.props.animSource && animTarget === this.props.animTarget) {
// console.warn(construct.name, 'thinks its same props') // console.warn(construct.name, 'thinks its same props')
return false; return false;

View File

@ -78,7 +78,7 @@ function registerEvents(store) {
store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimSource(null));
store.dispatch(actions.setAnimTarget(null)); store.dispatch(actions.setAnimTarget(null));
store.dispatch(actions.setAnimText(null)); store.dispatch(actions.setAnimText(null));
return setTimeout(cb, 50); return cb();
}, timeout); }, timeout);
}, err => { }, err => {