Skip to content

IA-985: Perf: Memoize educationLevelOptions, subjectOptions, and chapterOptions in AIAssistantForm

khadija.elbachouri a demandé de fusionner feature/IA-985 vers develop

Summary

Minor performance improvement in the AIAssistantForm component to avoid unnecessary re-computation of derived arrays on every render.

Changes

AIAssistantForm

  • Added useMemo import
  • Wrapped educationLevelOptions, subjectOptions, and chapterOptions with useMemo so they are only recomputed when their source arrays (levels, localSubjects, localChapters) actually change

Why

These three arrays were previously recomputed on every render, which could cause unnecessary re-renders of child components (e.g. Select / MenuItem lists) since they received new array references each time, even when the underlying data hadn't changed.

Rapports de requête de fusion