File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useState , useEffect } from 'react' ;
1+ import { useState } from 'react' ;
22import { useNavigate } from 'react-router-dom' ;
33import { designStorage , Design } from '../services/designStorage' ;
44import {
@@ -18,17 +18,14 @@ import {
1818
1919export const MyDesigns = ( ) => {
2020 const navigate = useNavigate ( ) ;
21- const [ designs , setDesigns ] = useState < Design [ ] > ( [ ] ) ;
21+ // Load initial designs from storage to avoid useEffect cascading render
22+ const [ designs , setDesigns ] = useState < Design [ ] > ( ( ) => designStorage . getAllDesigns ( ) ) ;
2223 const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
2324 const [ viewMode , setViewMode ] = useState < 'grid' | 'list' > ( 'grid' ) ;
2425 const [ showImportModal , setShowImportModal ] = useState ( false ) ;
2526 const [ importJson , setImportJson ] = useState ( '' ) ;
2627 const [ importName , setImportName ] = useState ( '' ) ;
2728
28- useEffect ( ( ) => {
29- loadDesigns ( ) ;
30- } , [ ] ) ;
31-
3229 const loadDesigns = ( ) => {
3330 setDesigns ( designStorage . getAllDesigns ( ) ) ;
3431 } ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export interface Design {
88 id : string ;
99 name : string ;
1010 description ?: string ;
11- schema : any ;
11+ schema : Record < string , unknown > ;
1212 createdAt : string ;
1313 updatedAt : string ;
1414 isTemplate ?: boolean ;
You can’t perform that action at this time.
0 commit comments