Skip to content

Add memoization level for the search aggregation fetch hook

Administrator requested to merge vk/fix-extra-aggregation-api-call into main

Created by: vovakulikov

Fixes https://github.com/sourcegraph/sourcegraph/issues/40902

Background

This PR does two things

  • Adds extra logic to avoid unnecessary extra API network requests in the search page initial mount
  • Fixes aggregation mode availability when aggregation query has got an error.

Test plan

  • Open your dev tools and go to the homepage
  • Try to search anything
  • Check that the network tab has only one request about search aggregation GetSearchAggregation.
  • Check that search aggregation controls work as expected and have no regressions (changing query re-triggers aggregation, changing pattern type re-triggers aggregation, changing aggregation mode re-triggers aggregation)

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading