* wrap PasteInput updates in a setTimeout * just wrap the whole callback
This commit is contained in:
parent
abd2c8e695
commit
4515559b1a
1 changed files with 48 additions and 36 deletions
|
@ -79,7 +79,18 @@ export const TextInput = forwardRef(
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const onChangeText = useCallback(
|
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})
|
const newRt = new RichText({text: newText})
|
||||||
newRt.detectFacetsWithoutResolution()
|
newRt.detectFacetsWithoutResolution()
|
||||||
setRichText(newRt)
|
setRichText(newRt)
|
||||||
|
@ -125,6 +136,7 @@ export const TextInput = forwardRef(
|
||||||
if (!isEqual(set, suggestedLinks)) {
|
if (!isEqual(set, suggestedLinks)) {
|
||||||
onSuggestedLinksChanged(set)
|
onSuggestedLinksChanged(set)
|
||||||
}
|
}
|
||||||
|
}, 1)
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
setRichText,
|
setRichText,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue