Commit 5d6408a
committed
Fix critique: Extraction métadonnées CompreFace dans reconnaissance
BUG CRITIQUE:
- Utilisateur clique UNE fois → 4 requêtes POST simultanées
- 1× 500 error + 3× 409 conflict
- Cause: Event listeners empilés à chaque refresh/changement tab
ROOT CAUSE:
1. loadTabData('personnel') appelé à chaque:
- Changement de tab
- Auto-refresh (30s)
- Rafraîchissement manuel
2. Chaque appel → initPersonnelManagement() → setupPersonnelForm()
3. setupPersonnelForm() ajoute NOUVEAU event listener SANS vérifier
4. Résultat: Après 4 appels = 4 event listeners = 4 POST simultanés
PROBLÈME SECONDAIRE:
- isSubmitting était local (closure) dans chaque event listener
- Pas de protection inter-listeners
- Chaque listener a sa propre variable isSubmitting
FIX IMPLÉMENTÉ:
✅ Flag global: personnelFormInitialized
✅ Flag global: isSubmittingPersonnel
✅ setupPersonnelForm() check si déjà initialisé → return early
✅ Event listener attaché UNE SEULE fois
✅ Protection globale contre soumissions multiples
RÉSULTAT:
- 1 clic → 1 requête POST (pas 4)
- isSubmittingPersonnel partagé entre tous les appels
- Event listener attaché une seule fois au chargement
- Logs: "Personnel form already initialized, skipping duplicate setup"
dashboard-service/src/static/js/dashboard.js:1083-1085
dashboard-service/src/static/js/dashboard.js:1137-1140
dashboard-service/src/static/js/dashboard.js:1150-1152
dashboard-service/src/static/js/dashboard.js:1216-1218
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent fd64271 commit 5d6408a
1 file changed
+18
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1080 | 1080 | | |
1081 | 1081 | | |
1082 | 1082 | | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1083 | 1087 | | |
1084 | 1088 | | |
1085 | 1089 | | |
| |||
1129 | 1133 | | |
1130 | 1134 | | |
1131 | 1135 | | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1132 | 1142 | | |
1133 | 1143 | | |
1134 | 1144 | | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | 1145 | | |
1139 | 1146 | | |
1140 | 1147 | | |
1141 | 1148 | | |
1142 | | - | |
1143 | | - | |
| 1149 | + | |
| 1150 | + | |
1144 | 1151 | | |
1145 | 1152 | | |
1146 | 1153 | | |
| |||
1153 | 1160 | | |
1154 | 1161 | | |
1155 | 1162 | | |
1156 | | - | |
| 1163 | + | |
1157 | 1164 | | |
1158 | 1165 | | |
1159 | 1166 | | |
| |||
1200 | 1207 | | |
1201 | 1208 | | |
1202 | 1209 | | |
1203 | | - | |
| 1210 | + | |
1204 | 1211 | | |
1205 | 1212 | | |
1206 | 1213 | | |
1207 | 1214 | | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1208 | 1219 | | |
1209 | 1220 | | |
1210 | 1221 | | |
| |||
0 commit comments