@@ -57,8 +57,8 @@ const EditQuestionsTable: React.FC<EditQuestionsTableProps> = ({onEdit, onDelete
57
57
setCurrentPage ( 1 ) ;
58
58
} ;
59
59
60
- const handleExpandClick = ( title : string ) => {
61
- expandedQuestion === title ? setExpandedQuestion ( false ) : setExpandedQuestion ( title ) ;
60
+ const handleExpandClick = ( id : string ) => {
61
+ expandedQuestion === id ? setExpandedQuestion ( false ) : setExpandedQuestion ( id ) ;
62
62
}
63
63
64
64
const indexOfLastQuestion = currentPage * itemsPerPage ;
@@ -79,30 +79,30 @@ const EditQuestionsTable: React.FC<EditQuestionsTableProps> = ({onEdit, onDelete
79
79
</ TableHead >
80
80
< TableBody >
81
81
{ currentQuestions . map ( ( question :Question ) => (
82
- < React . Fragment key = { question . title } >
82
+ < React . Fragment key = { question . id } >
83
83
< TableRow
84
84
sx = { { '& > *' : { borderBottom : 'unset' } } }
85
85
hover
86
- onClick = { ( ) => handleExpandClick ( question . title ) }
87
- selected = { expandedQuestion === question . title }
86
+ onClick = { ( ) => handleExpandClick ( question . id ) }
87
+ selected = { expandedQuestion === question . id }
88
88
>
89
89
< TableCell >
90
90
< IconButton
91
91
aria-label = "expand row"
92
92
size = "small"
93
- onClick = { ( ) => handleExpandClick ( question . title ) }
93
+ onClick = { ( ) => handleExpandClick ( question . id ) }
94
94
>
95
- { expandedQuestion === question . title ?
95
+ { expandedQuestion === question . id ?
96
96
< Typography > ▼</ Typography > : < Typography > ▶</ Typography > }
97
97
</ IconButton >
98
98
</ TableCell >
99
99
< TableCell component = "th" > { question . title } </ TableCell >
100
100
< TableCell > { question . categories . join ( ', ' ) } </ TableCell >
101
101
< TableCell > { question . difficulty } </ TableCell >
102
102
</ TableRow >
103
- < TableRow key = { question . title + "_details" } >
103
+ < TableRow key = { question . id + "_details" } >
104
104
< TableCell style = { { paddingBottom : 0 , paddingTop : 0 } } colSpan = { 4 } >
105
- < Collapse in = { question . title === expandedQuestion } timeout = "auto" unmountOnExit >
105
+ < Collapse in = { question . id === expandedQuestion } timeout = "auto" unmountOnExit >
106
106
< EditQuestionTab question = { question } onEdit = { onEdit } onDelete = { onDelete } />
107
107
</ Collapse >
108
108
</ TableCell >
0 commit comments