-
Notifications
You must be signed in to change notification settings - Fork 2k
STATS-59 - Match filename for the location stats to production #103281
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
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
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 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Async-loaded Components (~67 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. |
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.
Pull Request Overview
This PR updates the file naming for location stats to match the production behavior by incorporating the geoMode query parameter into the filename for CSV downloads.
- Added import of GEO_MODES from the types module.
- Introduced geoMode and geoModeLabel variables based on the query parameter, with a default fallback.
- Updated the DownloadCsv component path to include geoModeLabel for 'statsCountryViews'.
Comments suppressed due to low confidence (1)
client/my-sites/stats/summary/index.jsx:397
- [nitpick] Consider extracting the computed path logic into a well-named constant to enhance readability and simplify potential future modifications.
path={ statType === 'statsCountryViews' ? `${ path }-${ geoModeLabel }` : path }
Co-authored-by: Copilot <[email protected]>
@@ -367,6 +368,11 @@ class StatsSummary extends Component { | |||
backLink += domain; | |||
} | |||
const navigationItems = [ { label: backLabel, href: backLink }, { label: title } ]; | |||
const geoMode = this.props.context.query.geoMode; |
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.
Could we have a Locations module dedicated scope for this query parameter?
let pathForCsvFile = path;
if ( module === 'locations' ) {
const geoMode = this.props.context.query.geoMode;
const geoModeLabel =
geoMode && Object.prototype.hasOwnProperty.call( GEO_MODES, geoMode )
? GEO_MODES[ geoMode ]
: 'country';
pathForCsvFile = `${ path }-${ geoModeLabel }`;
}
@@ -391,7 +397,9 @@ class StatsSummary extends Component { | |||
<DownloadCsv | |||
statType={ statType } | |||
query={ moduleQuery } | |||
path={ path } | |||
path={ | |||
statType === 'statsCountryViews' ? `${ path }-${ geoModeLabel }` : path |
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.
There will be a countryviews-country
filename for the legacy Countries module, isn't it?
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.
Pull Request Overview
This PR updates the filename generation logic for location stats to match production. Key changes include:
- Importing GEO_MODES from the types module.
- Computing a geoModeLabel based on the query parameter.
- Conditionally appending geoModeLabel to the path prop in the DownloadCsv component.
Comments suppressed due to low confidence (1)
client/my-sites/stats/summary/index.jsx:400
- [nitpick] Consider extracting the conditional path assignment to a variable for improved readability and easier future modifications.
path={ statType === 'statsCountryViews' ? `${ path }-${ geoModeLabel }` : path }
@@ -367,6 +368,11 @@ class StatsSummary extends Component { | |||
backLink += domain; | |||
} | |||
const navigationItems = [ { label: backLabel, href: backLink }, { label: title } ]; | |||
const geoMode = this.props.context.query.geoMode; |
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.
[nitpick] Add a comment explaining the expected values in GEO_MODES and why defaulting to 'country' is appropriate to help future maintainers understand the mapping.
const geoMode = this.props.context.query.geoMode; | |
const geoMode = this.props.context.query.geoMode; | |
// `GEO_MODES` maps geoMode values (e.g., 'country', 'region', 'city') to their display labels. | |
// Defaulting to 'country' ensures a fallback label is used when geoMode is invalid or undefined, | |
// as 'country' is the most commonly used and broadly applicable geographic level. |
Copilot uses AI. Check for mistakes.
Part of STATS-59
Proposed Changes
Why are these changes being made?
Testing Instructions
Pre-merge Checklist