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(media): make sure we reset 'nextPageHandle' in case query changes #44579

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

flootr
Copy link
Contributor

@flootr flootr commented Jul 31, 2020

Changes proposed in this Pull Request

Reported via p1596152527276500-slack-C02DQP0FP

  • media state: make sure nextPageHandle is reset in case query changes
  • media data layer: don't refill the store with data in case the query changed during the request

There seemed to be timing issues where switching back and forth between filters in the media library (Images, Documents, etc) would mix up request. That caused a new request, for example on Images, to use query data from the previously chosen filter (especially nextPageHandle) and wouldn't fetch most recent data but where the previous request finished.

Testing instructions

  1. Go to a site with a lot of images (> 200) and open the media library /1
  2. Now switch back and forth between "All" and "Images"
  3. Make sure you always get the most recent image first after switching
  4. It's also a good idea to smoke test media library on /media, classic editor and Gutenberg

/1 to reproduce this bug (on the main branch) it's necessary to change filters while images are still being loaded

@flootr flootr added the [Feature] Media The media screen in Calypso, general media management, or integration with third party media. label Jul 31, 2020
@flootr flootr self-assigned this Jul 31, 2020
@matticbot
Copy link
Contributor

@flootr flootr marked this pull request as ready for review July 31, 2020 06:09
@flootr flootr added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 31, 2020
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~36 bytes added 📈 [gzipped])

name        parsed_size           gzip_size
entry-main        +95 B  (+0.0%)      +36 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~564 bytes added 📈 [gzipped])

name              parsed_size           gzip_size
stats                  +697 B  (+0.1%)     +173 B  (+0.1%)
woocommerce            +448 B  (+0.0%)      +72 B  (+0.0%)
settings-writing       +448 B  (+0.1%)      +65 B  (+0.0%)
settings               +448 B  (+0.1%)      +65 B  (+0.0%)
post-editor            +448 B  (+0.0%)      +59 B  (+0.0%)
media                  +448 B  (+0.1%)      +65 B  (+0.1%)
gutenberg-editor       +448 B  (+0.0%)      +65 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~78 bytes added 📈 [gzipped])

name                      parsed_size           gzip_size
async-load-design-blocks       +448 B  (+0.0%)      +78 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@flootr flootr requested review from sarayourfriend and a team July 31, 2020 06:18
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM. Good work digging into that issue 👍

@sarayourfriend sarayourfriend merged commit a30fff4 into master Jul 31, 2020
@sarayourfriend sarayourfriend deleted the fix/media-fetching-page-handle branch July 31, 2020 19:27
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media The media screen in Calypso, general media management, or integration with third party media.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants