Full parallel implementation of typesense and opensearch

This commit is contained in:
Stefan Hardegger
2025-09-20 09:40:09 +02:00
parent 54df3c471e
commit f1773873d4
20 changed files with 2869 additions and 290 deletions

View File

@@ -49,7 +49,7 @@ export default function StoryReadingPage() {
));
// Convert to character position in the plain text content
const textLength = story.contentPlain?.length || story.contentHtml.length;
const textLength = story.contentPlain?.length || story.contentHtml?.length || 0;
return Math.floor(scrollRatio * textLength);
}, [story]);
@@ -57,7 +57,7 @@ export default function StoryReadingPage() {
const calculateReadingPercentage = useCallback((currentPosition: number): number => {
if (!story) return 0;
const totalLength = story.contentPlain?.length || story.contentHtml.length;
const totalLength = story.contentPlain?.length || story.contentHtml?.length || 0;
if (totalLength === 0) return 0;
return Math.round((currentPosition / totalLength) * 100);
@@ -67,7 +67,7 @@ export default function StoryReadingPage() {
const scrollToCharacterPosition = useCallback((position: number) => {
if (!contentRef.current || !story || hasScrolledToPosition) return;
const textLength = story.contentPlain?.length || story.contentHtml.length;
const textLength = story.contentPlain?.length || story.contentHtml?.length || 0;
if (textLength === 0 || position === 0) return;
const ratio = position / textLength;