Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Bad lag/slowness when entering repost name #3055

Open
keikari opened this issue Feb 6, 2024 · 2 comments
Open

Mobile: Bad lag/slowness when entering repost name #3055

keikari opened this issue Feb 6, 2024 · 2 comments

Comments

@keikari
Copy link
Contributor

keikari commented Feb 6, 2024

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.

@infinite-persistence
Copy link
Collaborator

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]);

Suggestion:

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.

@tzarebczan
Copy link
Contributor

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)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants