fix scrolling to position.
This commit is contained in:
@@ -281,8 +281,10 @@ export default function StoryReadingPage() {
|
|||||||
// Wait for images to load before scrolling so scrollHeight is accurate
|
// Wait for images to load before scrolling so scrollHeight is accurate
|
||||||
const waitForImagesAndScroll = () => {
|
const waitForImagesAndScroll = () => {
|
||||||
if (!contentRef.current) {
|
if (!contentRef.current) {
|
||||||
// Content not in DOM yet, use a small delay
|
// Content not in DOM yet (e.g. series API still loading) — retry
|
||||||
setTimeout(performScroll, 500);
|
// until the ref is available rather than jumping straight to performScroll,
|
||||||
|
// which would silently no-op and never set hasScrolledToPosition.
|
||||||
|
if (!cancelled) setTimeout(waitForImagesAndScroll, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ export default function CollectionReadingView({
|
|||||||
// Wait for images to load before scrolling so scrollHeight is accurate
|
// Wait for images to load before scrolling so scrollHeight is accurate
|
||||||
const waitForImagesAndScroll = () => {
|
const waitForImagesAndScroll = () => {
|
||||||
if (!contentRef.current) {
|
if (!contentRef.current) {
|
||||||
setTimeout(performScroll, 500);
|
// Content not in DOM yet — retry until the ref is available.
|
||||||
|
if (!cancelled) setTimeout(waitForImagesAndScroll, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user