issue: https://linear.app/comm/issue/ENG-4897/[web]-warnings-in-message-search-modal
when I did the following:
- Search for a word
- Scroll down
- Clear the search query
I was seeing warnings on the console:
socket sent error data isn't of type T erverError: data isn't of type T at InflightRequests.resolveRequestsForMessage (inflight-requests.js:142:139) at WebSocket.eval (socket.react.js:170:24)
This was because when the query was cleared queries.current[threadID] was undefined, instead of an empty string. So code in useSearchMessages didn't handle it correctly. This is fixed by this diff, as getQuery returns
queries.current[threadID] ?? ''. useSearchMessages then decieds not to call the server, but return right away.