this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Cache textWeight

+16 -6
+16 -6
src/components/status.jsx
··· 12 12 import mem from 'mem'; 13 13 import pThrottle from 'p-throttle'; 14 14 import { memo } from 'preact/compat'; 15 - import { useEffect, useMemo, useRef, useState } from 'preact/hooks'; 15 + import { 16 + useCallback, 17 + useEffect, 18 + useMemo, 19 + useRef, 20 + useState, 21 + } from 'preact/hooks'; 16 22 import { InView } from 'react-intersection-observer'; 17 23 import { useLongPress } from 'use-long-press'; 18 24 import useResizeObserver from 'use-resize-observer'; ··· 286 292 287 293 const unauthInteractionErrorMessage = `Sorry, your current logged-in instance can't interact with this post from another instance.`; 288 294 289 - const textWeight = () => 290 - Math.max( 291 - Math.round((spoilerText.length + htmlContentLength(content)) / 140) || 1, 292 - 1, 293 - ); 295 + const textWeight = useCallback( 296 + () => 297 + Math.max( 298 + Math.round((spoilerText.length + htmlContentLength(content)) / 140) || 299 + 1, 300 + 1, 301 + ), 302 + [spoilerText, content], 303 + ); 294 304 295 305 const createdDateText = niceDateTime(createdAtDate); 296 306 const editedDateText = editedAt && niceDateTime(editedAtDate);