Upload folder using huggingface_hub
Browse files
client/src/pages/TutorialTasks.tsx
CHANGED
|
@@ -126,6 +126,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 126 |
// Minimal, local scroll-stability helpers for submit/delete
|
| 127 |
// Basic UA check; Chrome on iOS uses WKWebView but includes 'CriOS'
|
| 128 |
const isSafari = typeof navigator !== 'undefined' && /Safari\//.test(navigator.userAgent) && !/Chrome\//.test(navigator.userAgent) && !/CriOS\//.test(navigator.userAgent);
|
|
|
|
| 129 |
|
| 130 |
const lockListHeight = () => {
|
| 131 |
const el = listRef.current;
|
|
@@ -320,8 +321,10 @@ const TutorialTasks: React.FC = () => {
|
|
| 320 |
|
| 321 |
const loadDocs = useCallback(async () => {
|
| 322 |
try {
|
|
|
|
| 323 |
if (mutatingTaskId) {
|
| 324 |
try { console.log('[Trace] Docs:skipDuringMutate', { weekNumber, mutatingTaskId }); } catch {}
|
|
|
|
| 325 |
return;
|
| 326 |
}
|
| 327 |
try { console.log('[Trace] Docs:fetch', { weekNumber }); } catch {}
|
|
@@ -892,7 +895,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 892 |
|
| 893 |
try {
|
| 894 |
setMutatingTaskId(taskId);
|
| 895 |
-
if (isSafari) {
|
| 896 |
try { (document.activeElement as HTMLElement | null)?.blur?.(); } catch {}
|
| 897 |
freezeScroll();
|
| 898 |
}
|
|
@@ -990,7 +993,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 990 |
unlockCardHeightById(taskId);
|
| 991 |
unlockGridHeightById(taskId);
|
| 992 |
unlockContainerHeightById(taskId);
|
| 993 |
-
if (isSafari) { unfreezeScroll(); }
|
| 994 |
};
|
| 995 |
if (isSafari) {
|
| 996 |
requestAnimationFrame(() => requestAnimationFrame(() => requestAnimationFrame(release)));
|
|
@@ -1044,7 +1047,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 1044 |
|
| 1045 |
try {
|
| 1046 |
if (taskId) setMutatingTaskId(taskId);
|
| 1047 |
-
if (isSafari) { freezeScroll(); }
|
| 1048 |
lockListHeight();
|
| 1049 |
if (taskId) {
|
| 1050 |
lockCardHeightById(taskId);
|
|
@@ -1110,7 +1113,7 @@ const TutorialTasks: React.FC = () => {
|
|
| 1110 |
unlockGridHeightById(taskId);
|
| 1111 |
}
|
| 1112 |
if (isSafari) {
|
| 1113 |
-
unfreezeScroll();
|
| 1114 |
// Safari: delay per-task refetch until after unlock to avoid visible reflow
|
| 1115 |
if (taskId) {
|
| 1116 |
setTimeout(() => {
|
|
|
|
| 126 |
// Minimal, local scroll-stability helpers for submit/delete
|
| 127 |
// Basic UA check; Chrome on iOS uses WKWebView but includes 'CriOS'
|
| 128 |
const isSafari = typeof navigator !== 'undefined' && /Safari\//.test(navigator.userAgent) && !/Chrome\//.test(navigator.userAgent) && !/CriOS\//.test(navigator.userAgent);
|
| 129 |
+
const SAFARI_FREEZE_ENABLED = false; // disable body-freeze so scroll compensation can apply
|
| 130 |
|
| 131 |
const lockListHeight = () => {
|
| 132 |
const el = listRef.current;
|
|
|
|
| 321 |
|
| 322 |
const loadDocs = useCallback(async () => {
|
| 323 |
try {
|
| 324 |
+
// throttle fetch during and just after mutations to avoid reflow interference
|
| 325 |
if (mutatingTaskId) {
|
| 326 |
try { console.log('[Trace] Docs:skipDuringMutate', { weekNumber, mutatingTaskId }); } catch {}
|
| 327 |
+
setTimeout(() => { if (!mutatingTaskId) loadDocs(); }, 400);
|
| 328 |
return;
|
| 329 |
}
|
| 330 |
try { console.log('[Trace] Docs:fetch', { weekNumber }); } catch {}
|
|
|
|
| 895 |
|
| 896 |
try {
|
| 897 |
setMutatingTaskId(taskId);
|
| 898 |
+
if (isSafari && SAFARI_FREEZE_ENABLED) {
|
| 899 |
try { (document.activeElement as HTMLElement | null)?.blur?.(); } catch {}
|
| 900 |
freezeScroll();
|
| 901 |
}
|
|
|
|
| 993 |
unlockCardHeightById(taskId);
|
| 994 |
unlockGridHeightById(taskId);
|
| 995 |
unlockContainerHeightById(taskId);
|
| 996 |
+
if (isSafari && SAFARI_FREEZE_ENABLED) { unfreezeScroll(); }
|
| 997 |
};
|
| 998 |
if (isSafari) {
|
| 999 |
requestAnimationFrame(() => requestAnimationFrame(() => requestAnimationFrame(release)));
|
|
|
|
| 1047 |
|
| 1048 |
try {
|
| 1049 |
if (taskId) setMutatingTaskId(taskId);
|
| 1050 |
+
if (isSafari && SAFARI_FREEZE_ENABLED) { freezeScroll(); }
|
| 1051 |
lockListHeight();
|
| 1052 |
if (taskId) {
|
| 1053 |
lockCardHeightById(taskId);
|
|
|
|
| 1113 |
unlockGridHeightById(taskId);
|
| 1114 |
}
|
| 1115 |
if (isSafari) {
|
| 1116 |
+
if (SAFARI_FREEZE_ENABLED) unfreezeScroll();
|
| 1117 |
// Safari: delay per-task refetch until after unlock to avoid visible reflow
|
| 1118 |
if (taskId) {
|
| 1119 |
setTimeout(() => {
|