linguabot commited on
Commit
bb98e5c
·
verified ·
1 Parent(s): 7640732

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +12 -5
client/src/pages/TutorialTasks.tsx CHANGED
@@ -916,9 +916,12 @@ const TutorialTasks: React.FC = () => {
916
  // Measure grid height and set spacer before refetch to keep layout height constant
917
  const gridEl = submissionsGridRefs.current[taskId];
918
  const containerEl = submissionsContainerRefs.current[taskId];
 
919
  const preGridH = gridEl ? gridEl.getBoundingClientRect().height : 0;
920
  const preContH = containerEl ? containerEl.getBoundingClientRect().height : 0;
921
- const preHeight = preGridH > 0 ? preGridH : preContH;
 
 
922
  if (preHeight > 0) setSpacerHeights(prev => ({ ...prev, [taskId]: preHeight }));
923
  lastPreHeightRef.current[taskId] = preHeight;
924
  disableCompensationRef.current.add(taskId);
@@ -936,10 +939,12 @@ const TutorialTasks: React.FC = () => {
936
  setSpacerHeights(prev => ({ ...prev, [taskId]: 0 }));
937
  const afterGrid = submissionsGridRefs.current[taskId];
938
  const afterCont = submissionsContainerRefs.current[taskId];
 
939
  const afterGridH = afterGrid ? afterGrid.getBoundingClientRect().height : 0;
940
  const afterContH = afterCont ? afterCont.getBoundingClientRect().height : 0;
941
- const afterH = afterGridH > 0 ? afterGridH : afterContH;
942
- try { console.log('[Trace] Submit:unlockGate', { taskId, preHeight, afterH }); } catch {}
 
943
  const doUnlock = () => {
944
  unlockListHeight();
945
  unlockCardHeightById(taskId);
@@ -955,10 +960,12 @@ const TutorialTasks: React.FC = () => {
955
  requestAnimationFrame(() => {
956
  const afterGrid2 = submissionsGridRefs.current[taskId];
957
  const afterCont2 = submissionsContainerRefs.current[taskId];
 
958
  const afterGridH2 = afterGrid2 ? afterGrid2.getBoundingClientRect().height : 0;
959
  const afterContH2 = afterCont2 ? afterCont2.getBoundingClientRect().height : 0;
960
- const afterH2 = afterGridH2 > 0 ? afterGridH2 : afterContH2;
961
- try { console.log('[Trace] Submit:unlockGate2', { taskId, preHeight, afterH2 }); } catch {}
 
962
  if ((afterH2 || 0) > 0 && (afterH || 0) > 0 && Math.abs(afterH2 - afterH) <= 1) {
963
  doUnlock();
964
  } else {
 
916
  // Measure grid height and set spacer before refetch to keep layout height constant
917
  const gridEl = submissionsGridRefs.current[taskId];
918
  const containerEl = submissionsContainerRefs.current[taskId];
919
+ const cardEl = cardRefs.current[taskId];
920
  const preGridH = gridEl ? gridEl.getBoundingClientRect().height : 0;
921
  const preContH = containerEl ? containerEl.getBoundingClientRect().height : 0;
922
+ const preCardH = cardEl ? cardEl.getBoundingClientRect().height : 0;
923
+ const preHeight = preGridH > 0 ? preGridH : (preContH > 0 ? preContH : preCardH);
924
+ try { console.log('[Trace] Submit:preHeights', { taskId, preGridH, preContH, preCardH, chosen: preHeight }); } catch {}
925
  if (preHeight > 0) setSpacerHeights(prev => ({ ...prev, [taskId]: preHeight }));
926
  lastPreHeightRef.current[taskId] = preHeight;
927
  disableCompensationRef.current.add(taskId);
 
939
  setSpacerHeights(prev => ({ ...prev, [taskId]: 0 }));
940
  const afterGrid = submissionsGridRefs.current[taskId];
941
  const afterCont = submissionsContainerRefs.current[taskId];
942
+ const afterCard = cardRefs.current[taskId];
943
  const afterGridH = afterGrid ? afterGrid.getBoundingClientRect().height : 0;
944
  const afterContH = afterCont ? afterCont.getBoundingClientRect().height : 0;
945
+ const afterCardH = afterCard ? afterCard.getBoundingClientRect().height : 0;
946
+ const afterH = afterGridH > 0 ? afterGridH : (afterContH > 0 ? afterContH : afterCardH);
947
+ try { console.log('[Trace] Submit:unlockGate', { taskId, preHeight, afterH, afterGridH, afterContH, afterCardH }); } catch {}
948
  const doUnlock = () => {
949
  unlockListHeight();
950
  unlockCardHeightById(taskId);
 
960
  requestAnimationFrame(() => {
961
  const afterGrid2 = submissionsGridRefs.current[taskId];
962
  const afterCont2 = submissionsContainerRefs.current[taskId];
963
+ const afterCard2 = cardRefs.current[taskId];
964
  const afterGridH2 = afterGrid2 ? afterGrid2.getBoundingClientRect().height : 0;
965
  const afterContH2 = afterCont2 ? afterCont2.getBoundingClientRect().height : 0;
966
+ const afterCardH2 = afterCard2 ? afterCard2.getBoundingClientRect().height : 0;
967
+ const afterH2 = afterGridH2 > 0 ? afterGridH2 : (afterContH2 > 0 ? afterContH2 : afterCardH2);
968
+ try { console.log('[Trace] Submit:unlockGate2', { taskId, preHeight, afterH2, afterGridH2, afterContH2, afterCardH2 }); } catch {}
969
  if ((afterH2 || 0) > 0 && (afterH || 0) > 0 && Math.abs(afterH2 - afterH) <= 1) {
970
  doUnlock();
971
  } else {