Skip to content

woop: uses combobox to navigate countries - #59876

Merged
allilevine merged 13 commits into
trunkfrom
add/country-and-region-dropdown-to-address-step
Jan 12, 2022
Merged

allilevine merged 13 commits into
trunkfrom
add/country-and-region-dropdown-to-address-step

Conversation

@Rolilink

@Rolilink Rolilink commented Jan 7, 2022 •

Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request

  • Updating Country/Region dropdown to use ComboboxControl

Screen Shot 2022-01-10 at 2 25 40 PM

Testing instructions

  • Apply D72720-code and sandbox the API.
  • Navigate to http://calypso.localhost:3000/start/woocommerce-install/store-address?site=<siteId>
  • Select a country (and region, if available) in the country dropdown
  • Fill the rest and click continue
  • With D72639-code it should send an http request to settings with woocommerce_default_country being the code of the selected country.

Related to #

@Rolilink Rolilink self-assigned this Jan 7, 2022
@github-actions

github-actions Bot commented Jan 7, 2022 •

Copy link
Copy Markdown

@matticbot

matticbot commented Jan 7, 2022 •

Copy link
Copy Markdown
Contributor

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

App Entrypoints (~11 bytes removed 📉 [gzipped])

Details
name         parsed_size           gzip_size
entry-main         +83 B  (+0.0%)      -11 B  (-0.0%)
entry-login        +83 B  (+0.0%)       +2 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~1400 bytes added 📈 [gzipped])

Details
name                   parsed_size           gzip_size
signup                      +508 B  (+0.1%)      +36 B  (+0.1%)
site-purchases              +424 B  (+0.0%)      -12 B  (-0.0%)
purchases                   +424 B  (+0.0%)      -11 B  (-0.0%)
domains                     +411 B  (+0.0%)     -110 B  (-0.0%)
checkout                    +385 B  (+0.0%)      +59 B  (+0.0%)
site-blocks                 +372 B  (+0.1%)      +78 B  (+0.1%)
security                    +372 B  (+0.1%)      +78 B  (+0.1%)
privacy                     +372 B  (+0.1%)      +78 B  (+0.1%)
notification-settings       +372 B  (+0.1%)      +78 B  (+0.1%)
me                          +372 B  (+0.1%)      +78 B  (+0.1%)
help                        +372 B  (+0.1%)      +78 B  (+0.1%)
happychat                   +372 B  (+0.1%)      +78 B  (+0.1%)
concierge                   +372 B  (+0.1%)      +78 B  (+0.1%)
account-close               +372 B  (+0.1%)      +78 B  (+0.1%)
account                     +372 B  (+0.1%)      +89 B  (+0.1%)

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 (~5857 bytes added 📈 [gzipped])

Details
name                                                            parsed_size            gzip_size
async-load-signup-steps-woocommerce-install-step-store-address     +24929 B  (+18.3%)    +7536 B  (+17.0%)
async-load-design-wordpress-components-gallery                       +666 B   (+0.1%)      +70 B   (+0.0%)
async-load-block-editor                                              +666 B   (+0.0%)      +70 B   (+0.0%)
async-load-calypso-blocks-editor-checkout-modal                      +385 B   (+0.0%)      +59 B   (+0.0%)
async-load-design-playground                                         +372 B   (+0.0%)      +88 B   (+0.0%)
async-load-design                                                    +372 B   (+0.0%)      +88 B   (+0.0%)
async-load-signup-steps-woocommerce-install-confirm                   +44 B   (+0.0%)     +224 B   (+0.6%)

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.

@allilevine
allilevine force-pushed the add/country-and-region-dropdown-to-address-step branch 2 times, most recently from 3bf3221 to c1b8fb3 Compare January 10, 2022 21:50

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This component does not yet have types in the package definition for @wordpress/components which is causing your type errors. I've added them in DefinitelyTyped/DefinitelyTyped#58106. Once that merges and the calypso types are updated, this should pass the unit tests. The Calypso team can cause it to pass sooner if you ask!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, we might do that. cc @p-jackson since we're midchat about this 😆

@lsl

lsl commented Jan 11, 2022 •

Copy link
Copy Markdown
Contributor

Some kind of encoding happening on the output:

Screenshot 2022-01-11 at 13-52-25 Add WooCommerce to your site — WordPress com

edit: this is coming from translations, french and variants seems to have a lot of these other languages seem to be ok. Lets ignore for now, not something we need to fix.

@DustyReagan html_entity_decode in D72720-code will "fix" this but I'm not sure that's the right approach, pretty sure these should be rejected at the translation layer. Pinged #i18n here: p1641880808023800-slack-C02AED43D

@sirbrillig sirbrillig Jan 11, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure why exactly, but TS believes get( WOOCOMMERCE_DEFAULT_COUNTRY ) can return a number, which causes a type error since the value prop must be a string. Do you believe this should be a string? If so, can you cast it to a String here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it stemming from this? as string should be fine here right? I don't think there is any cases where a non string can enter this setting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@retrofox is blog_public required in this hook? Can't see where/how it's used (still catching up after the break) - might be faster to just remove the def.

@allilevine allilevine Jan 11, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@sirbrillig What's the best way to catch errors like these going forward? I wasn't seeing a type error there. 🤔

I cast it to a string here: ab4b8ac

Can't see where/how it's used (still catching up after the break) - might be faster to just remove the def.

@lsl I'm not seeing this either but it seems like get should be able to return different types, so I'm hesitant to limit it to strings.

@sirbrillig sirbrillig Jan 11, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good question! Sorry I didn't explain that earlier. You'd see the type errors if the types for ComboboxControl were available, but we're going to have to wait for the changes I merged there to be released and imported into calypso (and then rebased into this branch). Here's an example of when this was done recently: #59779

The reason I see them is that I manually added the types to my node_modules folder so I could check that they worked correctly, and that's why I was mentioning the errors to you here. This sort of thing is really weird and probably won't happen often.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

but we're going to have to wait for the changes I merged there to be released and imported into calypso (and then rebased into this branch)

Since it's not clear to me how long this process takes, you may want to ping the calypso team and ask them to mark these unit tests as passing (assuming the missing ComboboxControl is still the only new error). I'd do it but I don't have that power. 😅

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The reason I see them is that I manually added the types to my node_modules folder so I could check that they worked correctly, and that's why I was mentioning the errors to you here.

Ahhh! Got it, thanks!

@allilevine
allilevine force-pushed the add/country-and-region-dropdown-to-address-step branch from 475b3f9 to fb04e8d Compare January 11, 2022 14:52
@allilevine
allilevine requested a review from a team January 11, 2022 16:23
@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 Jan 11, 2022
That button seems defunc'd and also causes the input to be a different height than the rest. Clicking outside of the input field will reset it.
Without this style the suggestions list will expand the width of the entire form. This will keep it at the width of the other input fields.

@obenland obenland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good to me.

Should we wait until Automattic/jetpack#22248 made it to dotcom before merging it?

lsl added a commit that referenced this pull request Jan 12, 2022
@obenland

Copy link
Copy Markdown
Member

This should be good to go now.

@Automattic/team-calypso could we ask you to mark the unit tests as passing, as suggested here?

@tyxla

tyxla commented Jan 12, 2022 •

Copy link
Copy Markdown
Member

This was pending on #60002 essentially, but I've marked it as green now so you're unblocked to merge. Once #60002 lands, the related TS error that is being introduced here should get resolved.

@allilevine
allilevine merged commit 34db724 into trunk Jan 12, 2022
@allilevine
allilevine deleted the add/country-and-region-dropdown-to-address-step branch January 12, 2022 19:18
@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 Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

7 participants