Skip to content

feat: break up load api to tab specific#740

Merged
KristinAoki merged 11 commits intomasterfrom
KristinAoki/fix-home-api-time-out
Dec 19, 2023
Merged

feat: break up load api to tab specific#740
KristinAoki merged 11 commits intomasterfrom
KristinAoki/fix-home-api-time-out

Conversation

@KristinAoki
Copy link
Contributor

@KristinAoki KristinAoki commented Dec 11, 2023

JIRA Ticket: TNL-11244

Users are seeing the page load. The load time is very long and after the loading spinner goes away the page does not load correctly. The API is throwing a 504 (Gateway timeout) error.

This PR is dependent on edx-platform PR #33909

This PR separates the api call for the home page into three parts:

  1. Basic functionality call
  2. Courses data call
  3. Libraries data call

Separating the one api call into these three helps spread out the work on the api and help prevent timeout errors. The PR also adds error messages after each of the api calls so users will know when the api call has failed. Separating out the api will also help developers more easily find and resolve bugs in the loading process.

Testing

  1. Open the Network tab in DevTools
  2. Navigate to the Studio home page
  3. Page should load as expected tabs and number of courses
  4. Look at the Network tab and confirm that the home api call did not include courses, archived courses, or libraries
  5. Look at the Network tab and confirm that the courses api call was successful
  6. Click on the Library tab
  7. Should show spinner while loading libraries
  8. After loading completes, expected libraries should be listed
  9. In the home api call, update the url to be invalid
  10. Reload the page
  11. Page should load with failure alert
  12. Check Network tab and confirm the courses api was not called
  13. Fix the home api url and update the courses api to be invalid
  14. Reload the page
  15. The page should load the tabs and add course/library buttons
  16. The course tab should show failure alert
  17. Click the library tab
  18. Should load libraries as expected
  19. Fix the courses api and update the libraries api to be invalid
  20. Reload the page
  21. The page should load as expected with all the courses
  22. Click the library tab
  23. Tab should show failure alert

@codecov
Copy link

codecov bot commented Dec 11, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (7a4c9a3) 89.07% compared to head (08eb6d0) 89.21%.
Report is 1 commits behind head on master.

Files Patch % Lines
src/studio-home/StudioHome.jsx 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #740      +/-   ##
==========================================
+ Coverage   89.07%   89.21%   +0.14%     
==========================================
  Files         472      474       +2     
  Lines        7470     7540      +70     
  Branches     1601     1617      +16     
==========================================
+ Hits         6654     6727      +73     
+ Misses        788      785       -3     
  Partials       28       28              

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

@KristinAoki KristinAoki marked this pull request as ready for review December 11, 2023 20:42
Copy link
Contributor

@rayzhou-bit rayzhou-bit left a comment

Choose a reason for hiding this comment

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

The change looks great! I think having unit tests for the courses and libraries apis failing similar to the home api would be a good addition.

@KristinAoki
Copy link
Contributor Author

The change looks great! I think having unit tests for the courses and libraries apis failing similar to the home api would be a good addition.

There are tests for this state in TabsSection.test.jsx.

@rayzhou-bit
Copy link
Contributor

The change looks great! I think having unit tests for the courses and libraries apis failing similar to the home api would be a good addition.

There are tests for this state in TabsSection.test.jsx.

Sorry, I see it now. I was searching for getStudioHomeCourses and missed it.

@rayzhou-bit rayzhou-bit self-requested a review December 18, 2023 20:55
@KristinAoki KristinAoki merged commit 4c7faad into master Dec 19, 2023
@KristinAoki KristinAoki deleted the KristinAoki/fix-home-api-time-out branch December 19, 2023 14:10
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.

2 participants