Page MenuHomePhabricator

[web] Fix warnings on search screen
ClosedPublic

Authored by inka on Sep 11 2023, 5:48 AM.
Tags
None
Referenced Files
F3379763: D9123.diff
Wed, Nov 27, 6:58 PM
Unknown Object (File)
Wed, Nov 13, 1:27 PM
Unknown Object (File)
Wed, Nov 13, 1:27 PM
Unknown Object (File)
Wed, Nov 13, 1:27 PM
Unknown Object (File)
Mon, Nov 11, 5:56 AM
Unknown Object (File)
Mon, Nov 4, 5:06 PM
Unknown Object (File)
Oct 13 2024, 7:14 PM
Unknown Object (File)
Oct 13 2024, 7:14 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