* wrap PasteInput updates in a setTimeout * just wrap the whole callback
This commit is contained in:
@@ -79,7 +79,18 @@ export const TextInput = forwardRef(
|
||||
}))
|
||||
|
||||
const onChangeText = useCallback(
|
||||
async (newText: string) => {
|
||||
(newText: string) => {
|
||||
/*
|
||||
* This is a hack to bump the rendering of our styled
|
||||
* `textDecorated` to _after_ whatever processing is happening
|
||||
* within the `PasteInput` library. Without this, the elements in
|
||||
* `textDecorated` are not correctly painted to screen.
|
||||
*
|
||||
* NB: we tried a `0` timeout as well, but only positive values worked.
|
||||
*
|
||||
* @see https://github.com/bluesky-social/social-app/issues/929
|
||||
*/
|
||||
setTimeout(async () => {
|
||||
const newRt = new RichText({text: newText})
|
||||
newRt.detectFacetsWithoutResolution()
|
||||
setRichText(newRt)
|
||||
@@ -125,6 +136,7 @@ export const TextInput = forwardRef(
|
||||
if (!isEqual(set, suggestedLinks)) {
|
||||
onSuggestedLinksChanged(set)
|
||||
}
|
||||
}, 1)
|
||||
},
|
||||
[
|
||||
setRichText,
|
||||
|
||||
Reference in New Issue
Block a user