Page MenuHomePhabricator

[web] Fix warnings on search screen
ClosedPublic

Authored by inka on Sep 11 2023, 5:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 24, 2:29 AM
Unknown Object (File)
Sun, Sep 22, 2:59 PM
Unknown Object (File)
Sun, Sep 22, 5:13 AM
Unknown Object (File)
Sat, Sep 21, 10:22 PM
Unknown Object (File)
Sat, Sep 21, 10:15 PM
Unknown Object (File)
Sat, Sep 21, 8:59 PM
Unknown Object (File)
Sat, Sep 21, 8:53 PM
Unknown Object (File)
Wed, Sep 4, 11:53 PM
Subscribers

Details

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.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable