linguabot commited on
Commit
c7634ca
·
verified ·
1 Parent(s): 68e3f4c

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +14 -0
client/src/pages/TutorialTasks.tsx CHANGED
@@ -996,6 +996,8 @@ const TutorialTasks: React.FC = () => {
996
  const list = (r.data && r.data.submissions) || [];
997
  setUserSubmissions(prev => ({ ...prev, [taskId]: list }));
998
  requestAnimationFrame(() => {
 
 
999
  withPreservedCardOffset(taskId, () => {
1000
  unlockListHeight();
1001
  unlockCardHeightById(taskId);
@@ -1006,6 +1008,7 @@ const TutorialTasks: React.FC = () => {
1006
  });
1007
  }).catch(() => {
1008
  requestAnimationFrame(() => {
 
1009
  withPreservedCardOffset(taskId, () => {
1010
  unlockListHeight();
1011
  unlockCardHeightById(taskId);
@@ -1112,6 +1115,17 @@ const TutorialTasks: React.FC = () => {
1112
  }
1113
 
1114
  // Defer refetch to prevent UI jumping and preserve scroll around DOM updates
 
 
 
 
 
 
 
 
 
 
 
1115
  withPreservedCardOffset(taskId || '', () => {
1116
  try {
1117
  if (taskId) {
 
996
  const list = (r.data && r.data.submissions) || [];
997
  setUserSubmissions(prev => ({ ...prev, [taskId]: list }));
998
  requestAnimationFrame(() => {
999
+ // Allow scroll compensation at unlock time
1000
+ disableCompensationRef.current.delete(taskId);
1001
  withPreservedCardOffset(taskId, () => {
1002
  unlockListHeight();
1003
  unlockCardHeightById(taskId);
 
1008
  });
1009
  }).catch(() => {
1010
  requestAnimationFrame(() => {
1011
+ disableCompensationRef.current.delete(taskId);
1012
  withPreservedCardOffset(taskId, () => {
1013
  unlockListHeight();
1014
  unlockCardHeightById(taskId);
 
1115
  }
1116
 
1117
  // Defer refetch to prevent UI jumping and preserve scroll around DOM updates
1118
+ if (taskId) {
1119
+ const gridEl = submissionsGridRefs.current[taskId];
1120
+ const containerEl = submissionsContainerRefs.current[taskId];
1121
+ const cardEl = cardRefs.current[taskId];
1122
+ const preGridH = gridEl ? gridEl.getBoundingClientRect().height : 0;
1123
+ const preContH = containerEl ? containerEl.getBoundingClientRect().height : 0;
1124
+ const preCardH = cardEl ? cardEl.getBoundingClientRect().height : 0;
1125
+ const preHeight = preGridH > 0 ? preGridH : (preContH > 0 ? preContH : preCardH);
1126
+ lastPreHeightRef.current[taskId] = preHeight;
1127
+ try { console.log('[Trace] Delete:preHeights', { taskId, preGridH, preContH, preCardH, chosen: preHeight }); } catch {}
1128
+ }
1129
  withPreservedCardOffset(taskId || '', () => {
1130
  try {
1131
  if (taskId) {