-
Notifications
You must be signed in to change notification settings - Fork 2k
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: Ensure URL Scheme in Subscription List Component #95676
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~36 bytes added 📈 [gzipped])
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 (~35 bytes added 📈 [gzipped])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
@@ -96,6 +96,7 @@ class ConnectedSubscriptionListItem extends Component { | |||
export default compose( | |||
connect( ( state, ownProps ) => ( { | |||
isFollowing: isFollowingSelector( state, { feedId: ownProps.feedId, blogId: ownProps.siteId } ), | |||
url: ownProps.url.match( /^https?:\/\// ) ? ownProps.url : `http://${ ownProps.url }`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we prepend https
vs. http
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, though I noticed that the curated list URLs are inconsistent -- some have it, some don't. With this PR we don't need to worry about it, but we could alternatively add the correct URL scheme to all of the URLs instead.
I also noticed some URLs that aren't URLs and opened a separate PR: #95686
Related to #95624
The curated list URLs do not have 'http://' prefixes which means that the Subscribe API requests fail with the following error;
This code change adds logic to ensure that the
url
property in the component always includes a proper URL scheme (i.e.,http://
orhttps://
).If
ownProps.url
already starts withhttp://
orhttps://
, it will be left unchanged. However, if the URL doesn't start with a valid scheme,http://
is prepended to it. This change is applied in theconnect
function, which manages the component's data connection to the state and props.This ensures that the
url
is always a valid, complete URL when passed to the component.Proposed Changes
http://
to site URL if missing - this is needed when subscribing to a siteWhy are these changes being made?
Testing Instructions
/read?flags=reader/onboarding
Pre-merge Checklist