Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install react-query #4361

Merged
merged 13 commits into from
Jul 22, 2024
Merged

Install react-query #4361

merged 13 commits into from
Jul 22, 2024

Conversation

apata
Copy link
Contributor

@apata apata commented Jul 16, 2024

Changes

This PR aims to be a refactor only, without introducing any functional changes.

The main objective is to bring in the react-query library and start using it in BreakdownModal to handle fetching data from the backend (including functionalities such as pagination and loading state)

Slight UX improvements

  • The library contains out of the box caching of results, so when the user 1) opens the modal, 2) closes it, and 3) opens it again - we will display the cached results instead of an initial loading spinner. However, cached data is always considered stale, meaning that we'll still make the API request to fetch fresh data whenever the modal is opened. The cache will be trashed after 5 minutes, and after that, the initial loading spinner in the center of the modal will appear on the first render.
  • Adds back the loading spinner at the bottom when "Load more" is clicked. Currently on master the user cannot see the loading spinner at all, as it's in the modal header, which is hidden when the user has scrolled down.

Tests

  • This PR does not require tests

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@apata apata changed the title Install query Install react-query Jul 16, 2024
@apata apata force-pushed the install-use-query branch from 3e8414b to 281be47 Compare July 16, 2024 15:33
Copy link

Preview environment👷🏼‍♀️🏗️
PR-4361

@RobertJoonas RobertJoonas marked this pull request as ready for review July 17, 2024 13:46
@RobertJoonas RobertJoonas requested a review from ukutaht July 17, 2024 13:46
Copy link
Contributor

@ukutaht ukutaht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I really like the UX improvement from caching. One comment about naming below.

assets/js/dashboard/stats/modals/breakdown-modal.js Outdated Show resolved Hide resolved
@RobertJoonas RobertJoonas merged commit 1acbbf2 into master Jul 22, 2024
10 checks passed
@RobertJoonas RobertJoonas deleted the install-use-query branch July 22, 2024 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants