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

Stats: Date control update: Improve date selection behaviour #94565

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

kangzj
Copy link
Contributor

@kangzj kangzj commented Sep 15, 2024

Proposed Changes

  • The PR implement part of the smart date range selection behavior proposed in p9X8ns-54k-p2

Why are these changes being made?

  • Improve date range selection experience

Testing Instructions

  • should set start date when range is empty
  • should set end date when start date is set but end date is null
  • should clear start date when day is same as start date
  • should clear end date when day is same as end date
  • should set start date when day is before current range
  • should set end date when day is after current range
  • should set start date when day is closer to start
  • should set end date when day is closer to end
  • Ensure all tests pass
Screen.Recording.2024-09-16.at.3.37.24.PM.mov

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)?

@kangzj kangzj added the [Feature] Stats Everything related to our analytics product at /stats/ label Sep 15, 2024
@kangzj kangzj requested review from annacmc and a team September 15, 2024 23:41
@kangzj kangzj self-assigned this Sep 15, 2024
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Sep 15, 2024
@matticbot
Copy link
Contributor

matticbot commented Sep 15, 2024

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

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

  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/change-date-selection-behaviour on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Sep 15, 2024

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

Sections (~194 bytes added 📈 [gzipped])

name                           parsed_size           gzip_size
stats                               +197 B  (+0.0%)      +68 B  (+0.0%)
plugins                             +197 B  (+0.0%)      +70 B  (+0.0%)
media                               +197 B  (+0.0%)      +70 B  (+0.0%)
jetpack-cloud-agency-sites-v2       +197 B  (+0.0%)      +56 B  (+0.0%)
backup                              +197 B  (+0.0%)      +56 B  (+0.0%)
activity                            +197 B  (+0.0%)      +56 B  (+0.0%)
a8c-for-agencies-sites              +197 B  (+0.0%)      +56 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 (~138 bytes added 📈 [gzipped])

name                                               parsed_size           gzip_size
async-load-store-app-store-stats-listview               +197 B  (+0.0%)      +68 B  (+0.0%)
async-load-store-app-store-stats                        +197 B  (+0.0%)      +68 B  (+0.0%)
async-load-design-playground                            +197 B  (+0.0%)      +70 B  (+0.0%)
async-load-design-blocks                                +197 B  (+0.0%)      +70 B  (+0.0%)
async-load-design                                       +197 B  (+0.0%)      +70 B  (+0.0%)
async-load-calypso-post-editor-media-modal              +197 B  (+0.0%)      +70 B  (+0.0%)
async-load-calypso-post-editor-editor-media-modal       +197 B  (+0.0%)      +70 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.

@kangzj kangzj marked this pull request as ready for review September 16, 2024 03:38
Copy link
Contributor

@annacmc annacmc left a comment

Choose a reason for hiding this comment

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

This is awesome, nice one! The daterange picker is still working well for me on the live branch, but I'm seeing this error locally if I try to run the tests:

TypeError: _moment.default.locale is not a function

@annacmc
Copy link
Contributor

annacmc commented Sep 16, 2024

I just checked the teamcity Unit Tests on the build and looks like it's running into the same issue:

_moment.default.locale is not a function
TypeError: _moment.default.locale is not a function
    at Object.locale (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/client/components/localized-moment/context.js:4:62)
    at Runtime._execModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:882:12)
    at Runtime.requireModuleOrMock (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1048:21)
    at Object.require (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/client/components/localized-moment/index.js:3:1)
    at Runtime._execModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:882:12)
    at Runtime.requireModuleOrMock (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1048:21)
    at Object.require (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/client/components/date-picker/index.jsx:7:1)
    at Runtime._execModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:882:12)
    at Runtime.requireModuleOrMock (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1048:21)
    at Object.require (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/client/components/date-range/date-range-picker.tsx:3:1)
    at Runtime._execModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:882:12)
    at Runtime.requireModuleOrMock (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1048:21)
    at Object.require (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/client/components/date-range/test/add-date-to-range.js:2:1)
    at Runtime._execModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runtime/build/index.js:882:12)
    at jestAdapter (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:77:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at runTestInternal (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/home/teamcity-0/buildAgent/work/c4a9d5b38c1dacde/node_modules/jest-runner/build/testWorker.js:106:12)
    ```

@kangzj kangzj force-pushed the update/change-date-selection-behaviour branch from 9b5403c to e3bce02 Compare September 16, 2024 21:08
@kangzj kangzj requested a review from annacmc September 16, 2024 23:04
Copy link
Contributor

@annacmc annacmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍 🚀

@kangzj kangzj merged commit f6158b5 into trunk Sep 17, 2024
12 checks passed
@kangzj kangzj deleted the update/change-date-selection-behaviour branch September 17, 2024 02:16
@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 Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Stats Everything related to our analytics product at /stats/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants