mattermost/mattermost

Make Constants.SEARCH_TIMEOUT_MILLISECONDS configurable

Open

#28,442 建立於 2024年10月3日

在 GitHub 查看
 (14 留言) (0 反應) (1 負責人)TypeScript (32,880 star) (7,823 fork)batch import
Difficulty/2:MediumHacktoberfestHelp WantedTech/GoTech/ReactJS

描述

In the channel switcher, the webapp waits for Constants.SEARCH_TIMEOUT_MILLISECONDSto accumulate the letters and sending off the autocomplete request to the server. This value is currently hardcoded to 100ms with no way to configure it.

The problem is that unless a user types extremely rapidly, the first few letters will always spawn search requests. But then by the time the user finishes typing the search query, more requests go out, and come back faster with results because the match fewer results.

But the original requests are still being executed on the server, creating high latencies, and skewing the Grafana charts. This creates a lot of confusion for someone looking at the graphs. To fix this, we could increase the wait time to a higher value, or even better, make this a configurable setting.

The changes that need to be made for this are:

  1. Add a config setting for DisplaySettings.SuggestionDebounceDelay to the Config type on both the server (model.Config) and the client (Config and AdminConfig). It should default to the current value of Constants.SEARCH_TIMEOUT_MILLISECONDS.
  2. Expose the config setting to users by adding it to the data returned by GenerateClientConfig on the server.
  3. Replace all usage of Constants.SEARCH_TIMEOUT_MILLISECONDS on the web app with the value from the client config.
  4. Make the new setting configurable by adding it to admin_definitions.tsx in the web app. It should go under the Experimental Features section and have the following text:
    • Title: Suggestion Debounce Delay
    • Description: The number of milliseconds to wait after a user has stopped typing before showing autocomplete options or searching for suggestions. Affects components such as the message textbox, the Channel Members list and the Browse Channels modal.
  5. Submit a pull request to https://github.com/mattermost/docs/ to add documentation for the new setting there as well.

If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-60565

貢獻者指南