File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,22 @@ import './styles.scss';
2525const images = require . context ( '../../icons' , true ) ;
2626
2727const Table = ( ) => {
28- const [ checked , setChecked ] = useState (
28+ let checkedList =
2929 JSON . parse ( localStorage . getItem ( 'checked' ) ) ||
30- new Array ( questions . length ) . fill ( false ) ,
31- ) ;
30+ new Array ( questions . length ) . fill ( false ) ;
31+
32+ if ( checkedList . length !== questions . length ) {
33+ const newCheckedList = new Array ( questions . length ) . fill ( false ) ;
34+
35+ for ( let i = 0 ; i < checkedList . length ; i += 1 ) {
36+ newCheckedList [ i ] = checkedList [ i ] ;
37+ }
38+
39+ checkedList = newCheckedList ;
40+ window . localStorage . setItem ( 'checked' , JSON . stringify ( checkedList ) ) ;
41+ }
42+
43+ const [ checked , setChecked ] = useState ( checkedList ) ;
3244
3345 const [ showPatterns , setShowPatterns ] = useState (
3446 JSON . parse ( localStorage . getItem ( 'showPatterns' ) ) || new Array ( 1 ) . fill ( true ) ,
You can’t perform that action at this time.
0 commit comments