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

Components: withAPIData: Populate cached data for initial render #3058

Merged
merged 2 commits into from
Oct 27, 2017

Conversation

aduth
Copy link
Member

@aduth aduth commented Oct 18, 2017

This pull request seeks to improve the behavior of the withAPIData higher-order component to make data available during an initial render if a cached response is already available. Previously, even if the cache value was to become immediately available after mount, it would occur on an update after the initial mount. The changes here not only save a render in these cases, but it also seeks to resolve an issue where the publish dropdown menu doesn't initially focus tabbables within the dropdown menu because capabilities weren't yet known at the time.

Testing instructions:

Ensure unit tests pass:

npm run test-unit

Verify that there are no regressions in API data behavior, either in cases where data is fetched fresh (e.g. authors) or prepopulated (current user publish permissions).

Verify that the first tabbable panel in the publish menu becomes focused when the menu is opened. See #3057 for more context on whether we want this to occur on click behaviors.

@aduth aduth added the [Feature] UI Components Impacts or related to the UI component system label Oct 18, 2017
@codecov
Copy link

codecov bot commented Oct 18, 2017

Codecov Report

Merging #3058 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3058      +/-   ##
==========================================
+ Coverage   32.59%   32.65%   +0.06%     
==========================================
  Files         209      209              
  Lines        5965     5971       +6     
  Branches     1055     1057       +2     
==========================================
+ Hits         1944     1950       +6     
  Misses       3391     3391              
  Partials      630      630
Impacted Files Coverage Δ
components/higher-order/with-api-data/index.js 83.95% <100%> (+1.28%) ⬆️
components/higher-order/with-api-data/request.js 96% <100%> (ø) ⬆️

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 15c515b...b81f137. Read the comment docs.

@aduth aduth merged commit 6e61a70 into master Oct 27, 2017
@aduth aduth deleted the update/with-api-data-populate-cache branch October 27, 2017 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant