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

Fix double requests on default sort #1583

Merged
merged 11 commits into from
Sep 27, 2023
Merged

Conversation

kaperoo
Copy link
Contributor

@kaperoo kaperoo commented Sep 19, 2023

Fixed double requests bug on default sort

Any table/card view that uses default sorting now checks whether it has been mounted to prevent data requests being sent twice.
The isMounted variable is used to disable or enable queries in datagateway-common/api.

Testing instructions

Updated unit tests to check for double requests when default sort is specified.

  • Review code
  • Check Actions build
  • Review changes to test coverage

Agile board tracking

connect to #1582

@kaperoo kaperoo linked an issue Sep 19, 2023 that may be closed by this pull request
1 task
@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (48e434d) 96.19% compared to head (fddc48b) 96.23%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1583      +/-   ##
===========================================
+ Coverage    96.19%   96.23%   +0.03%     
===========================================
  Files          161      161              
  Lines         6863     6935      +72     
  Branches      2135     2147      +12     
===========================================
+ Hits          6602     6674      +72     
  Misses         240      240              
  Partials        21       21              
Flag Coverage Δ
common 95.53% <100.00%> (+0.01%) ⬆️
dataview 96.94% <100.00%> (+0.08%) ⬆️
download 96.32% <ø> (ø)
search 96.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...es/datagateway-common/src/api/dataPublications.tsx 100.00% <100.00%> (ø)
packages/datagateway-common/src/api/datafiles.tsx 100.00% <100.00%> (ø)
packages/datagateway-common/src/api/datasets.tsx 100.00% <100.00%> (ø)
...ages/datagateway-common/src/api/facilityCycles.tsx 100.00% <100.00%> (ø)
...ackages/datagateway-common/src/api/instruments.tsx 100.00% <100.00%> (ø)
...ages/datagateway-common/src/api/investigations.tsx 100.00% <100.00%> (ø)
...c/views/card/dls/dlsDatasetsCardView.component.tsx 100.00% <100.00%> (ø)
.../views/card/dls/dlsProposalsCardView.component.tsx 100.00% <100.00%> (ø)
...src/views/card/dls/dlsVisitsCardView.component.tsx 100.00% <100.00%> (ø)
...rd/isis/isisDataPublicationsCardView.component.tsx 100.00% <100.00%> (ø)
... and 16 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kaperoo kaperoo changed the title Double request bug fix in tables Double request bug fix Sep 25, 2023
@kaperoo kaperoo changed the title Double request bug fix Fix double requests on default sort Sep 25, 2023
@kaperoo kaperoo marked this pull request as ready for review September 26, 2023 14:35
Copy link
Member

@louise-davies louise-davies left a comment

Choose a reason for hiding this comment

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

LGTM - tried it out and it only sends the default sort-ed request, fixes the issue in an efficient way, and it's tested in the unit tests. @kevinphippsstfc for reference, this is the bug you raised and it's now got a fix if we need to hotfix this before the next DG release then let me know.

@kaperoo kaperoo merged commit 0bdc641 into develop Sep 27, 2023
louise-davies added a commit that referenced this pull request Sep 28, 2023
@louise-davies louise-davies deleted the bugfix/request-sent-twice-1582 branch October 6, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra request is sent when a table is loaded before the default sort is applied
2 participants