Skip to content

Commit

Permalink
do not load history on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
chetbox committed Dec 27, 2023
1 parent 7f0771f commit 42ba85b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hosting/src/components/Canvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ export default class Canvas extends Vue {
}
protected mounted() {
this.placeRef.on('value', this.onCanvasUpdated);
this.placeRef.child('depth').once('value', (snapshot: firebase.database.DataSnapshot) => {
this.data.canvasDepth = snapshot.val();
this.placeRef.child('canvas').on('value', this.onCanvasUpdated);
});
}
protected destroyed() {
this.placeRef.off('value', this.onCanvasUpdated);
this.placeRef.child('canvas').off('value', this.onCanvasUpdated);
}
private onCanvasUpdated(snapshot: firebase.database.DataSnapshot) {
Expand All @@ -71,8 +74,7 @@ export default class Canvas extends Vue {
return;
}
this.data.canvasDepth = snapshot.val().depth;
this.data.canvas = toGrid<number>(snapshot.val().canvas, emptyGrid(Math.pow(2, this.data.canvasDepth)));
this.data.canvas = toGrid<number>(snapshot.val(), emptyGrid(Math.pow(2, this.data.canvasDepth)));
}
private canvasId = 'the-one-and-only';
Expand Down

0 comments on commit 42ba85b

Please sign in to comment.