grafana / explore-profiles

Explore Profiles is a native Grafana application designed to integrate seamlessly with Pyroscope, the open-source continuous profiling platform, providing a smooth, query-less experience for browsing and analyzing profiling data.
GNU Affero General Public License v3.0
18 stars 1 forks source link

fix(*): Fix useUrlSearchParams #171

Closed grafakus closed 1 month ago

grafakus commented 1 month ago

โœจ Description

Related issue(s): -

Before this PR, the URL search parameters were not correctly picked up after being updated.

We can see this issue in the "Diff flame graph" view when the default maxNodes is not present in the URL. In this case, its value is determined by fetching the user settings, which takes some time. And because the useUrlSearchParams hook was not forcing a re-render after setting the new value, the component would never display the flame graph.

๐Ÿ“– Summary of the changes

useUrlSearchParams now relies on the useLocation hook from react-router-dom. As a result, the E2E tests related to the "Diff flame graph" view have now the correct screenshots (the incorrect screenshot should never have been pushed to the repo in the first place - shame on me ๐Ÿคฆ๐Ÿพโ€โ™‚๏ธ).

See diff tab for specific comments.

๐Ÿงช How to test?

github-actions[bot] commented 1 month ago

Unit test coverage

Lines Statements Branches Functions
Coverage: 10%
10.68% (478/4474) 8.2% (136/1658) 7.99% (109/1364)