HomePhabricator
Diffusion Comm 72d5a1003660

[web] Fix warnings on search screen

Description

[web] Fix warnings on search screen

Summary:
issue: https://linear.app/comm/issue/ENG-4897/[web]-warnings-in-message-search-modal
when I did the following:

  1. Search for a word
  2. Scroll down
  3. 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.

Test Plan: checked that in the scenario decribed in the summary the error does not appear. Checked that it is possible to fetch messages, and loda more by scrollng down.

Reviewers: ginsu, rohan, michal, atul

Reviewed By: michal

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D9123

Details

Provenance
inkaAuthored on Sep 11 2023, 5:44 AM
Reviewer
michal
Differential Revision
D9123: [web] Fix warnings on search screen
Parents
rCOMM18d58e18f1c4: Revert "Temporary changes for staff release"
Branches
Unknown
Tags
Unknown