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

chore(homepage): separate out api calls to make homepage load more dynamically #13500

Merged
merged 9 commits into from
Mar 22, 2021

Conversation

pkdotson
Copy link
Member

@pkdotson pkdotson commented Mar 6, 2021

SUMMARY

This pr is based off feedback from users with slow loading home page from api calls. The initial setup for page load was to batch call for all data on page load. This pr separates out api calls for recent activity and run mine's api calls in parallel on page load. This should allow some data to show faster on homepage without depending on long api requests.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

Unit test will be updated as change are made.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@pkdotson pkdotson marked this pull request as ready for review March 9, 2021 00:20
@pkdotson pkdotson requested a review from ktmud March 9, 2021 22:14
@@ -123,8 +115,50 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
);
}),
);

// Sets other activity data in parallel with recents api call
Copy link
Member

Choose a reason for hiding this comment

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

Always appreciate comments like this!

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

Changes look good to me, so I'll approve. There are some open questions/nits about typing and one more promise.all that might be OK to parallelize, so I'll refrain from merging in case you want to address that in this PR. Some parts (e.g. a pass at tighter typing) might be good to open another PR around if you'd rather not tackle it right now.

... last and least, a quick lint-fix looks to be warranted.

@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #13500 (ff3379c) into master (cfc83c2) will decrease coverage by 3.99%.
The diff coverage is 50.34%.

❗ Current head ff3379c differs from pull request most recent head f3db02b. Consider uploading reports for the commit f3db02b to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13500      +/-   ##
==========================================
- Coverage   77.17%   73.17%   -4.00%     
==========================================
  Files         905      615     -290     
  Lines       45675    21917   -23758     
  Branches     5511     5820     +309     
==========================================
- Hits        35248    16037   -19211     
+ Misses      10298     5737    -4561     
- Partials      129      143      +14     
Flag Coverage Δ
cypress 56.29% <37.99%> (-0.35%) ⬇️
hive ?
javascript 63.23% <42.81%> (-0.20%) ⬇️
mysql ?
postgres ?
presto ?
python ?
sqlite ?

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

Impacted Files Coverage Δ
...et-frontend/src/SqlLab/components/TableElement.jsx 88.37% <ø> (ø)
superset-frontend/src/SqlLab/reducers/sqlLab.js 40.24% <0.00%> (+1.30%) ⬆️
...src/SqlLab/utils/reduxStateToLocalStorageHelper.js 100.00% <ø> (ø)
superset-frontend/src/chart/ChartContainer.jsx 100.00% <ø> (ø)
...ontend/src/common/components/InfoTooltip/index.tsx 53.84% <ø> (ø)
...ontend/src/common/hooks/usePrevious/usePrevious.ts 100.00% <ø> (ø)
...components/AlteredSliceTag/AlteredSliceTagMocks.js 100.00% <ø> (ø)
...-frontend/src/components/AlteredSliceTag/index.jsx 98.66% <ø> (ø)
superset-frontend/src/components/Badge/index.tsx 100.00% <ø> (ø)
...nd/src/components/BootstrapSliderWrapper/index.jsx 0.00% <ø> (ø)
... and 584 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfc83c2...f3db02b. Read the comment docs.

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

Code LGTM with a couple of small nits (mostly naming suggestions). Didn't have time to test, though.

Happy to stamp once we have design/PM sign-off.

@junlincc junlincc added the home Namespace | Related to the Homepage label Mar 18, 2021
@junlincc junlincc self-requested a review March 18, 2021 23:15
Copy link
Member

@junlincc junlincc left a comment

Choose a reason for hiding this comment

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

not sure what's the best way to test, but compared before and after locally. difference in performance is quite noticeable?
Good to go! 🟢
Before
https://user-images.githubusercontent.com/67837651/111709553-0977eb00-8805-11eb-9abf-0d00d04a2cbb.mov
After
https://user-images.githubusercontent.com/67837651/111709580-172d7080-8805-11eb-81b3-23e0359ea456.mov

@github-actions
Copy link
Contributor

@junlincc Ephemeral environment spinning up at http://34.208.210.86:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@pkdotson pkdotson requested review from ktmud, rusackas and junlincc March 19, 2021 00:19
@ktmud
Copy link
Member

ktmud commented Mar 19, 2021

recents-empty-result.mp4

So it seems once other API is returned, "Recents" was rendered with an empty result before its own API response returns, resulting in a flash of the empty state---this is more noticeable if the /recent_activity API is slow or user network is slow in general---I tested this with network speed simulator in Chrome Dev Tools.

Can we get this fixed before merging this PR?

@pkdotson
Copy link
Member Author

@ktmud fixed

Screen.Recording.2021-03-19.at.5.50.18.PM.mov

@ktmud
Copy link
Member

ktmud commented Mar 20, 2021

Looks good!

@ktmud
Copy link
Member

ktmud commented Mar 20, 2021

/testenv up

@github-actions
Copy link
Contributor

@ktmud Ephemeral environment creation is currently limited to committers.

Copy link

@junlin-qa junlin-qa left a comment

Choose a reason for hiding this comment

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

good to go.

-junlin

@pkdotson pkdotson merged commit bbc306c into apache:master Mar 22, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
…namically (apache#13500)

* separate out api calls

* add new loading states

* remove consoles

* update tests

* fix types and lint

* make code more robust and add test

* address comments

* address comments

* fix lint
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels home Namespace | Related to the Homepage preset-io size/L 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants