From 37b4329c75a4a241ae19617e3061b0bdbc615a5a Mon Sep 17 00:00:00 2001 From: Echo Date: Fri, 27 Mar 2026 16:15:36 +0100 Subject: [PATCH] [Glitch] Profile redesign: Add Intl.Segmenter fallback Port 9a076359b9dd1a58ebf084d7b9361a3882ba4857 to glitch-soc Signed-off-by: Claire --- .../glitch/components/character_counter/index.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/javascript/flavours/glitch/components/character_counter/index.tsx b/app/javascript/flavours/glitch/components/character_counter/index.tsx index 6ffe4d02f4..6bc88c23ac 100644 --- a/app/javascript/flavours/glitch/components/character_counter/index.tsx +++ b/app/javascript/flavours/glitch/components/character_counter/index.tsx @@ -1,9 +1,9 @@ -import { useMemo } from 'react'; - import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; +import { length } from 'stringz'; + import { polymorphicForwardRef } from '@/types/polymorphic'; import classes from './styles.module.scss'; @@ -14,8 +14,6 @@ interface CharacterCounterProps { recommended?: boolean; } -const segmenter = new Intl.Segmenter(); - export const CharacterCounter = polymorphicForwardRef< 'span', CharacterCounterProps @@ -31,10 +29,7 @@ export const CharacterCounter = polymorphicForwardRef< }, ref, ) => { - const currentLength = useMemo( - () => [...segmenter.segment(currentString)].length, - [currentString], - ); + const currentLength = length(currentString); return (