🐛(components): add missing button types and keys
Check Deno code / Check Deno code (pull_request) Successful in 40s
Check Deno code / Check Deno code (pull_request) Successful in 40s
Add type="button" to the EditMobility and UploadStudents buttons to prevent default form submission behavior. Include a key prop on Student components in Promotion for stable list rendering.
This commit is contained in:
@@ -240,7 +240,7 @@ export default function EditMobility() {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<button onClick={handleSave} disabled={isSaving}>
|
<button type="button" onClick={handleSave} disabled={isSaving}>
|
||||||
{isSaving ? "Saving..." : "Confirm"}
|
{isSaving ? "Saving..." : "Confirm"}
|
||||||
</button>
|
</button>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function Promotion(props: PromotionProps) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{props.students
|
{props.students
|
||||||
.filter((student) => student.promotionId === props.promo.id)
|
.filter((student) => student.promotionId === props.promo.id)
|
||||||
.map((student) => <Student student={student} />)}
|
.map((student) => <Student key={student.id} student={student} />)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export default function UploadStudents() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<input type="file" accept=".xlsx, .xls" onChange={handleFileChange} />
|
<input type="file" accept=".xlsx, .xls" onChange={handleFileChange} />
|
||||||
<button onClick={confirmUpload}>Confirm Upload</button>
|
<button type="button" onClick={confirmUpload}>Confirm Upload</button>
|
||||||
<p>{statusMessage.value}</p>
|
<p>{statusMessage.value}</p>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user