File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import "./styles.css";
66const b = b_ . lock ( "Arena" ) ;
77const cellSize = 28 ;
88
9- export class Arena extends React . Component {
9+ export class Arena extends React . PureComponent {
1010 static defaultProps = { zoom : 1 } ;
1111
1212 state = {
Original file line number Diff line number Diff line change @@ -93,12 +93,13 @@ export class Minesweeper {
9393 this . openedCells ++ ;
9494 } ) ;
9595
96+ this . cells = [ ...this . cells ] ;
97+
9698 const restCells = this . cells
9799 . map ( ( cell , i ) => ( cell & CELL_OPENED ) ? null : i )
98100 . filter ( cell => cell !== null ) ;
99101
100102 if ( arraysCompare ( this . minedCells , restCells ) ) {
101-
102103 this . gameState = 'won' ;
103104 this . flaggingMode = false ;
104105 this . stopTimer ( ) ;
@@ -129,6 +130,7 @@ export class Minesweeper {
129130 const cell = this . cells [ i ] ;
130131 if ( ! ( cell & CELL_OPENED ) ) {
131132 this . cells [ i ] = toggleCellFlag ( cell ) ;
133+ this . cells = [ ...this . cells ] ;
132134 ( this . cells [ i ] & CELL_FLAGGED ) ? this . flaggedCells ++ : this . flaggedCells -- ;
133135 }
134136 this . _render ( ) ;
You can’t perform that action at this time.
0 commit comments