powerhouse-inc / connect

https://document-model-electron.vercel.app
3 stars 3 forks source link

Slow typing in 'Add drive' Modal on staging #327

Closed CallmeT-ty closed 3 months ago

CallmeT-ty commented 3 months ago

hmm looks like its the network response that is slow — makes sense because we are hitting the switchboard api when the user types something in there.

right now we have it set to wait 500 ms before performing the fetch, but its running the fetch every time the user types.

there's not much I can do about the network response, but I can make two changes that should improve things:

wait longer before fetching, since the user probably wants to type more than one character before searching

do a more basic check of the url before hitting the server. we can at least check if the url is well-formed, i.e. starts with https: and ends with .com. also can check if it has "switchboard" in the url too, since all of our urls have that. then it won't waste the network request by doing it as soon as you start typing

we can see here in the network requests that its hitting the server every time you type a new character. in the code its set up to block the input until the network request gets back, and each request is taking around 170ms to return.

Let's create an issue and chat about it later 👍

Image