Open keikari opened 9 months ago
This code being placed too high up in the tree. RepostCreate
that's underneath it is too huge to be re-rendering often.
const throttledContentValue = useThrottle(contentUri, 500);
const throttledRepostValue = useThrottle(repostUri, 500);
React.useEffect(() => {
if (throttledContentValue) {
resolveUri(throttledContentValue);
}
}, [throttledContentValue, resolveUri]);
React.useEffect(() => {
if (throttledRepostValue) {
resolveUri(throttledRepostValue);
}
}, [throttledRepostValue, resolveUri]);
React.useEffect(() => {
if (repostTo) {
resolveUri(repostTo);
}
}, [repostTo, resolveUri]);
Create a RepostName
component that encapsulate the repost_name
form field + other surrounding text elements + move the resolve calls here, so that the entire tree is not affected.
If still not performant enough, exclude the check-as-you-type and just resolve in handleSubmit
-- probably not too bad.
Another related issue in this area - if there's alot of channel tags, they overlay the name input box and you can't click into it (it then goes to the URL you're reposting)
https://discord.com/channels/721806979928162404/1203405569000611890/1203405569000611890 "I went to repost something on iOS Safari and for some reason the typing speed in the URL text box tanked. It's running like shit. Discord's letting my type at full speed while that's in the background, and come to think of it, every part of the site needs to reload every time I switch apps."
Wasn't able to repro here, seeing some minor hiccups on Firefox android. But barely noticeable.