linguabot commited on
Commit
5093374
·
verified ·
1 Parent(s): d2d3db1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +26 -20
client/src/pages/TutorialTasks.tsx CHANGED
@@ -323,7 +323,7 @@ const TutorialTasks: React.FC = () => {
323
  // throttle fetch during and just after mutations to avoid reflow interference
324
  if (mutatingTaskId) {
325
  try { console.log('[Trace] Docs:skipDuringMutate', { weekNumber, mutatingTaskId }); } catch {}
326
- setTimeout(() => { if (!mutatingTaskId) loadDocs(); }, 400);
327
  return;
328
  }
329
  if (isDocsFetchInFlightRef.current) {
@@ -1146,27 +1146,33 @@ const TutorialTasks: React.FC = () => {
1146
  }
1147
  // let DOM settle then unlock (both list and card if id known)
1148
  requestAnimationFrame(() => requestAnimationFrame(() => {
1149
- unlockListHeight();
1150
- if (taskId) {
1151
- unlockCardHeightById(taskId);
1152
- unlockGridHeightById(taskId);
1153
- }
1154
- if (isSafari) {
1155
- if (SAFARI_FREEZE_ENABLED) unfreezeScroll();
1156
- // Safari: delay per-task refetch until after unlock to avoid visible reflow
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1157
  if (taskId) {
1158
- setTimeout(() => {
1159
- api.get(`/api/submissions/by-source/${taskId}`).then(r => {
1160
- const list = (r.data && r.data.submissions) || [];
1161
- setUserSubmissions(prev => ({ ...prev, [taskId]: list }));
1162
- try {
1163
- const el = cardRefs.current[taskId];
1164
- const topAfter = el ? el.getBoundingClientRect().top : null;
1165
- console.log('[Trace] ScrollPreserve(del):after', { taskId, topAfter });
1166
- } catch {}
1167
- }).catch(() => {});
1168
- }, 300);
1169
  }
 
1170
  }
1171
  setMutatingTaskId(null);
1172
  }));
 
323
  // throttle fetch during and just after mutations to avoid reflow interference
324
  if (mutatingTaskId) {
325
  try { console.log('[Trace] Docs:skipDuringMutate', { weekNumber, mutatingTaskId }); } catch {}
326
+ setTimeout(() => { if (!mutatingTaskId) loadDocs(); }, 600);
327
  return;
328
  }
329
  if (isDocsFetchInFlightRef.current) {
 
1146
  }
1147
  // let DOM settle then unlock (both list and card if id known)
1148
  requestAnimationFrame(() => requestAnimationFrame(() => {
1149
+ if (isSafari && taskId) {
1150
+ // Hold locks until per-task refetch completes
1151
+ pendingUnlocksRef.current.add(taskId);
1152
+ setTimeout(() => {
1153
+ api.get(`/api/submissions/by-source/${taskId}`).then(r => {
1154
+ const list = (r.data && r.data.submissions) || [];
1155
+ setUserSubmissions(prev => ({ ...prev, [taskId]: list }));
1156
+ }).catch(() => {}).finally(() => {
1157
+ unlockListHeight();
1158
+ unlockCardHeightById(taskId);
1159
+ unlockGridHeightById(taskId);
1160
+ if (SAFARI_FREEZE_ENABLED) unfreezeScroll();
1161
+ pendingUnlocksRef.current.delete(taskId);
1162
+ try {
1163
+ const el = cardRefs.current[taskId];
1164
+ const topAfter = el ? el.getBoundingClientRect().top : null;
1165
+ console.log('[Trace] ScrollPreserve(del):after', { taskId, topAfter });
1166
+ } catch {}
1167
+ });
1168
+ }, 300);
1169
+ } else {
1170
+ unlockListHeight();
1171
  if (taskId) {
1172
+ unlockCardHeightById(taskId);
1173
+ unlockGridHeightById(taskId);
 
 
 
 
 
 
 
 
 
1174
  }
1175
+ if (isSafari && SAFARI_FREEZE_ENABLED) { unfreezeScroll(); }
1176
  }
1177
  setMutatingTaskId(null);
1178
  }));