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

Reader: update list stream paging #95155

Merged
merged 5 commits into from
Oct 17, 2024
Merged

Reader: update list stream paging #95155

merged 5 commits into from
Oct 17, 2024

Conversation

eoigal
Copy link
Contributor

@eoigal eoigal commented Oct 4, 2024

Fixes https://github.com/Automattic/loop/issues/184

This PR works with the patch D163263-code. The patch adds an API handler for https://public-api.wordpress.com/rest/v1.3/read/list/automattic/a12s/posts API call from this PR.

The paging on the list posts page doesn't work well. This has to do with how the API handler for version 1.2 mishandles pagination on large lists like /read/list/automattic/a12s.

If you scroll down far enough on https://wordpress.com/read/list/automattic/a12s you probably will see the stream only load past couple of months of posts.

Now you should be able to keep streaming posts as you scroll down.

Before

list-posts-live-480.mov

After

streambuilder-480.mov

Proposed Changes

  • Updates the /read/list Reader stream API call to include a page_handle and to use API version 1.3.

Why are these changes being made?

  • Improve UX

Testing Instructions

  • Make sure public-api.wordpress.com is sandboxed
  • Go to /read/list/automattic/a12s and confirm the stream loads as expected in chronological order
  • Go to /read/list/kristastevens/favorite-magazines and confirm the stream loads as expected in chronological order

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@eoigal eoigal requested a review from a team as a code owner October 4, 2024 14:32
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 4, 2024
@matticbot
Copy link
Contributor

matticbot commented Oct 4, 2024

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

Sections (~58 bytes added 📈 [gzipped])

name                             parsed_size           gzip_size
reader                                 +71 B  (+0.0%)      +58 B  (+0.0%)
plugins                                +71 B  (+0.0%)      +58 B  (+0.0%)
jetpack-cloud-plugin-management        +71 B  (+0.0%)      +58 B  (+0.0%)
home                                   +71 B  (+0.0%)      +58 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.

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.

@eoigal eoigal force-pushed the update/list-stream branch from 182d124 to be63de9 Compare October 7, 2024 13:27
@eoigal
Copy link
Contributor Author

eoigal commented Oct 16, 2024

The following patches have been deployed to add support for the list posts stream using Stream builder framework of the v1.3 API endpoint.

  • D163263-code
  • D163845-code
  • D163853-code
  • D163855-code
  • D163943-code
  • D163957-code
  • D163970-code

Copy link
Member

@DustyReagan DustyReagan left a comment

Choose a reason for hiding this comment

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

I tested this against the production API. I tested /read/list/kristastevens/favorite-magazines and /read/list/automattic/a12s.
✅ The posts are in reverse chronological order
✅ I can page/scroll much further back in time

Copy link
Contributor

@holdercp holdercp left a comment

Choose a reason for hiding this comment

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

  • I was able to scroll back months at /read/list/automattic/a12s without hitting an "end"
  • The posts at /read/list/kristastevens/favorite-magazines were in reverse chronological order (most recent first)

I did repeatedly get a "Could not retrieve comments for post" error but I don't suspect that it's related to these changes. I did sandbox the API with trunk checked out.

@eoigal eoigal merged commit 70bae98 into trunk Oct 17, 2024
14 checks passed
@eoigal eoigal deleted the update/list-stream branch October 17, 2024 09:01
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 17, 2024
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.

4 participants