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

Refactor/276 avoid multiple api calls #362

Merged
merged 11 commits into from
Apr 15, 2024

Conversation

ekraffmiller
Copy link
Contributor

@ekraffmiller ekraffmiller commented Apr 5, 2024

What this PR does / why we need it:

Updates useDatasets.tsx to make one API call, to get both datasetList and totalDatasetsCount

Which issue(s) this PR closes:

Special notes for your reviewer:

I commented out an assertion in DatasetsList.spec.tsx, because it is failing, even though the cy.stub() that it is testing is called with the correct parameters. I'm not sure why it is failing.

Suggestions on how to test this:

Run the DatasetsList.spec.tsx component test, which uses useDatasets.tsx. To test how it works in the app, turn off infinite scrolling by updating config.ts in the collections directory, and test that the Collections page works as expected.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

no

Is there a release notes update needed for this change?:

Additional documentation:

@ekraffmiller ekraffmiller marked this pull request as ready for review April 5, 2024 01:57
@ekraffmiller ekraffmiller added pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 3 A percentage of a sprint. 2.1 hours. labels Apr 5, 2024
@MellyGray MellyGray self-assigned this Apr 8, 2024
Copy link
Contributor

@MellyGray MellyGray left a comment

Choose a reason for hiding this comment

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

Since datasetRepository.getAll and and datasetRepository.getTotalDatasetsCount are not longer being used we can remove all the related code

  1. methods from the repository
  2. associated use cases
  3. Integration tests
  4. Repository mocks used in the stories

@MellyGray MellyGray assigned ekraffmiller and unassigned MellyGray Apr 10, 2024
@coveralls
Copy link

coveralls commented Apr 10, 2024

Coverage Status

coverage: 97.694% (+0.2%) from 97.494%
when pulling 83a93d4 on refactor/276-avoid-multiple-api-calls
into 9addf4d on develop.

@ekraffmiller
Copy link
Contributor Author

thanks @MellyGray I made the changes you requested

MellyGray
MellyGray previously approved these changes Apr 11, 2024
Copy link
Contributor

@MellyGray MellyGray left a comment

Choose a reason for hiding this comment

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

LGTM!

@MellyGray MellyGray removed their assignment Apr 11, 2024
@g-saracca g-saracca self-assigned this Apr 12, 2024
@g-saracca
Copy link
Contributor

QA ✅, there are no repeated calls to the api now, I also disabled React.StrictMode to actually see one call in dev mode, nice work @ekraffmiller !
Could you resolve conflicts and we are good to go !

@g-saracca g-saracca merged commit 3aa4685 into develop Apr 15, 2024
7 of 8 checks passed
@g-saracca g-saracca deleted the refactor/276-avoid-multiple-api-calls branch April 15, 2024 11:23
jayanthkomarraju pushed a commit to jayanthkomarraju/dataverse-frontend that referenced this pull request May 31, 2024
…-calls

Refactor/276 avoid multiple api calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 3 A percentage of a sprint. 2.1 hours.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor getDatasetPreviews and getFiles to avoid multiple calls
4 participants