Page MenuHomePhabricator

[native] Compute typeahead suggestions and matched strings outside the class component
ClosedPublic

Authored by rohan on Dec 18 2023, 6:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 10:02 PM
Unknown Object (File)
Fri, Nov 8, 7:17 PM
Unknown Object (File)
Fri, Nov 8, 7:17 PM
Unknown Object (File)
Fri, Nov 8, 7:17 PM
Unknown Object (File)
Fri, Nov 8, 7:17 PM
Unknown Object (File)
Fri, Nov 8, 7:17 PM
Unknown Object (File)
Fri, Nov 8, 1:13 PM
Unknown Object (File)
Oct 13 2024, 6:11 AM
Subscribers

Details

Summary

In order to use a hook that will get user mention candidates that are resolved, we need to first extract the logic to compute user chat mention candidates outside of the class component. There are two steps to this:

  1. Lift the selectionState out of the class component
  2. Move the computation logic out of the class component

This diff just covers step 2. We should now be able to refactor getMentionTypeaheadUserSuggestions into a hook that will allow for @ mentioning ENS users by their name.

Addresses https://linear.app/comm/issue/ENG-6112/update-native-chat-input-bar-to-make-it-easier-to-use-hooks

Depends on D10385

Test Plan

Once again confirmed that there were no regressions introduced by this changed. I also added some console.log statements for suggestions both off master and this diff, and made sure that I didn't notice any additional re-renderings caused by this change.

Diff Detail

Repository
rCOMM Comm
Branch
ens
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

native/chat/chat-input-bar.react.js
1295–1299

Essentially copy and pasted from the class component above

1307–1308

This is so we keep the old behavior of not showing the typeahead tooltip if typeaheadRegexMatches is null

1312–1331

Essentially copy and pasted from the class component above

Harbormaster returned this revision to the author for changes because remote builds failed.Dec 18 2023, 6:59 AM
Harbormaster failed remote builds in B25186: Diff 34801!
rohan requested review of this revision.Dec 18 2023, 8:52 AM

Seems like a straightforward refactor

This revision is now accepted and ready to land.Dec 20 2023, 10:14 PM