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

Hide empty content in favor of Reader onboarding. #96988

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

allilevine
Copy link
Member

@allilevine allilevine commented Dec 2, 2024

Proposed Changes

  • Change the Scrolling Feed view to show Reader Onboarding when there are no subscriptions (like the Full Post view does now).
Before After
Screen Shot 2024-12-02 at 3 19 50 PM Screen Shot 2024-12-02 at 5 50 29 PM

Why are these changes being made?

  • Clean up the empty content state on /read.

Testing Instructions

  • Remove all of your subscriptions.
  • Go to /read?flags=reader/recent-feed-overhaul
  • Check that you see onboarding and not the "Welcome to Reader" content. The view toggle shouldn't be visible, either.
  • Go to /read without the feature flag and check that you see onboarding and not the "Welcome to Reader" content.
  • Subscribe to your own site(s). Check that you still see Reader Onboarding with and without the flag.
  • Complete onboarding or add a subscription to a site you don't own, and check that you see your feeds and can toggle views with the flag applied.

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 UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • 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)?

@allilevine allilevine self-assigned this Dec 2, 2024
@matticbot
Copy link
Contributor

matticbot commented Dec 2, 2024

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

Sections (~52 bytes added 📈 [gzipped])

name    parsed_size           gzip_size
reader       +252 B  (+0.0%)      +52 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.

@allilevine allilevine marked this pull request as ready for review December 2, 2024 20:20
@allilevine allilevine requested a review from a team as a code owner December 2, 2024 20:20
@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 Dec 2, 2024
@holdercp
Copy link
Contributor

holdercp commented Dec 2, 2024

@allilevine I just had a thought: not everyone sees Reader onboarding, correct? I think we only show it to new accounts. So this change could show a "blank" screen if someone doesn't have any subscriptions and is not presented with onboarding.

@allilevine
Copy link
Member Author

@allilevine I just had a thought: not everyone sees Reader onboarding, correct? I think we only show it to new accounts. So this change could show a "blank" screen if someone doesn't have any subscriptions and is not presented with onboarding.

@holdercp Thanks for catching that! What about adding the forceShow flag to this view, like on the new view, so that onboarding shows whenever subscriptions are 0?

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/reader-recent-empty-state on your sandbox.

@eoigal
Copy link
Contributor

eoigal commented Dec 2, 2024

I noticed a small difference between production and this branch. It looks like if the account has no subscriptions (except the users own site), in production we show the Welcome to Reader content. With this branch it doesn't show the Welcome to Reader content OR the new onboarding. I had to delete the subscription to the users own site too to get it work as expected.

Screen.Recording.2024-12-02.at.23.02.23.mov

@allilevine
Copy link
Member Author

I noticed a small difference between production and this branch. It looks like if the account has no subscriptions (except the users own site), in production we show the Welcome to Reader content. With this branch it doesn't show the Welcome to Reader content OR the new onboarding. I had to delete the subscription to the users own site too to get it work as expected.

Screen.Recording.2024-12-02.at.23.02.23.mov

@eoigal Nice catch! I added a check for subscriptions to sites that the user is an owner of. I also added back "Welcome to Reader" for conditions we may have missed. Do you happen to know where we filter out the users' own blogs? I'm wondering if it's just owners, or if they're a member of the site.

const isLoading = isLoadingCount || isLoadingSiteSubscriptions;

const hasNonSelfSubscriptions = useMemo( () => {
if ( isLoading ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this check in this function? I think having it within the hasNonSelfSubscriptions function muddies the intent of the function, meaning the value really represents hasNonSelfSubscriptionsAndNotLoadingSubscriptions 😂.

Can we move the loading check outside of this function? It looks like we're checking isLoading again on line 50 so maybe this check is redundant anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, it's redundant. I went ahead and removed it. 👍

}

return subscriptionsCount.blogs > 0;
}, [ subscriptionsCount?.blogs, siteSubscriptions, isLoading ] );
Copy link
Contributor

Choose a reason for hiding this comment

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

Does using the optional chaining here impact useMemo? What if it resolves to undefined? I would suspect it would be fine and would work like we expect and re-run the function if that first item changes from undefined to an array or object.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah if subscriptionsCount is undefined, it would just re-run. I updated to explicitly check the object.

} }
/>
) }
<DataViews
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 I think pulling all the subscription logic up into main makes this much easier to reason about.

@holdercp
Copy link
Contributor

holdercp commented Dec 3, 2024

I'm still seeing reader onboarding even if I have subscriptions:

image

I did this by manually following sites from discover or search. Based on this change, I would expect onboarding to be hidden in the scroll view.

@allilevine
Copy link
Member Author

I'm still seeing reader onboarding even if I have subscriptions:
I did this by manually following sites from discover or search. Based on this change, I would expect onboarding to be hidden in the scroll view.

@holdercp That's expected when you meet the normal conditions for Reader Onboarding: new account that hasn't completed onboarding yet. It's still called here.

When I create a new user I do have some initial subscriptions, so seeing it there might be common (as opposed to a new account with no subscriptions at all).

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.

:shipit:

@allilevine allilevine merged commit 514ebfd into trunk Dec 3, 2024
11 checks passed
@allilevine allilevine deleted the update/reader-recent-empty-state branch December 3, 2024 18:39
@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 Dec 3, 2024
@allilevine
Copy link
Member Author

I'm noticing now that completing onboarding in the empty state doesn't refresh the view and show your subscriptions. I can follow up on that.

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