linguabot commited on
Commit
6ea7288
·
verified ·
1 Parent(s): 014d406

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +14 -5
client/src/pages/TutorialTasks.tsx CHANGED
@@ -905,7 +905,10 @@ const TutorialTasks: React.FC = () => {
905
  // Defer state updates and minimal refetch
906
  // Measure grid height and set spacer before refetch to keep layout height constant
907
  const gridEl = submissionsGridRefs.current[taskId];
908
- const preHeight = gridEl ? gridEl.getBoundingClientRect().height : 0;
 
 
 
909
  if (preHeight > 0) setSpacerHeights(prev => ({ ...prev, [taskId]: preHeight }));
910
  withPreservedCardOffset(taskId, () => {
911
  React.startTransition(() => {
@@ -919,8 +922,11 @@ const TutorialTasks: React.FC = () => {
919
  // Release spacer one frame after list update to avoid jump
920
  requestAnimationFrame(() => {
921
  setSpacerHeights(prev => ({ ...prev, [taskId]: 0 }));
922
- const afterEl = submissionsGridRefs.current[taskId];
923
- const afterH = afterEl ? afterEl.getBoundingClientRect().height : 0;
 
 
 
924
  try { console.log('[Trace] Submit:unlockGate', { taskId, preHeight, afterH }); } catch {}
925
  const doUnlock = () => {
926
  unlockListHeight();
@@ -934,8 +940,11 @@ const TutorialTasks: React.FC = () => {
934
  } else {
935
  // Gate one more frame for Safari layout to settle
936
  requestAnimationFrame(() => {
937
- const afterEl2 = submissionsGridRefs.current[taskId];
938
- const afterH2 = afterEl2 ? afterEl2.getBoundingClientRect().height : 0;
 
 
 
939
  try { console.log('[Trace] Submit:unlockGate2', { taskId, preHeight, afterH2 }); } catch {}
940
  doUnlock();
941
  });
 
905
  // Defer state updates and minimal refetch
906
  // Measure grid height and set spacer before refetch to keep layout height constant
907
  const gridEl = submissionsGridRefs.current[taskId];
908
+ const containerEl = submissionsContainerRefs.current[taskId];
909
+ const preGridH = gridEl ? gridEl.getBoundingClientRect().height : 0;
910
+ const preContH = containerEl ? containerEl.getBoundingClientRect().height : 0;
911
+ const preHeight = preGridH > 0 ? preGridH : preContH;
912
  if (preHeight > 0) setSpacerHeights(prev => ({ ...prev, [taskId]: preHeight }));
913
  withPreservedCardOffset(taskId, () => {
914
  React.startTransition(() => {
 
922
  // Release spacer one frame after list update to avoid jump
923
  requestAnimationFrame(() => {
924
  setSpacerHeights(prev => ({ ...prev, [taskId]: 0 }));
925
+ const afterGrid = submissionsGridRefs.current[taskId];
926
+ const afterCont = submissionsContainerRefs.current[taskId];
927
+ const afterGridH = afterGrid ? afterGrid.getBoundingClientRect().height : 0;
928
+ const afterContH = afterCont ? afterCont.getBoundingClientRect().height : 0;
929
+ const afterH = afterGridH > 0 ? afterGridH : afterContH;
930
  try { console.log('[Trace] Submit:unlockGate', { taskId, preHeight, afterH }); } catch {}
931
  const doUnlock = () => {
932
  unlockListHeight();
 
940
  } else {
941
  // Gate one more frame for Safari layout to settle
942
  requestAnimationFrame(() => {
943
+ const afterGrid2 = submissionsGridRefs.current[taskId];
944
+ const afterCont2 = submissionsContainerRefs.current[taskId];
945
+ const afterGridH2 = afterGrid2 ? afterGrid2.getBoundingClientRect().height : 0;
946
+ const afterContH2 = afterCont2 ? afterCont2.getBoundingClientRect().height : 0;
947
+ const afterH2 = afterGridH2 > 0 ? afterGridH2 : afterContH2;
948
  try { console.log('[Trace] Submit:unlockGate2', { taskId, preHeight, afterH2 }); } catch {}
949
  doUnlock();
950
  });