-
Notifications
You must be signed in to change notification settings - Fork 2k
Woo installer: Add email field to address step #59970
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
629a0de
Add email field to address step
allilevine 2990bb6
Simplify return
allilevine b2f9c66
Simplify onChange
allilevine 51af260
Add correct types to hook
allilevine 33983db
Update profile object with spread to preserve data
allilevine 7c096db
Fix TypeScript error
allilevine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Fix TypeScript error
- Loading branch information
commit 7c096db0ca7aada5158803f3c986b66a9b1745a5
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hey! I was working on #72348, which resulted in
arraybeing changed toArray. I think this caused a cascade of type issues which were unfortunately not caught in this branch!Firstly, it seems like
woocommerce_onboarding_profilemight be an Object, given that it's set toRecord<string, unknown>. But beyond that, I don't think JSDoc/Typescript fully understood thearraytype.The result is that before I made changes in #72348, the return type for the getter function was "any", I think because Typescript couldn't infer the type:
wp-calypso/client/signup/steps/woocommerce-install/hooks/use-site-settings/index.tsx
Lines 56 to 66 in ea8bb7f
This made all the consuming code compile correctly, but once the JSDoc type gets fixed, Typescript starts inferring the correct return type. Unfortunately, the other types aren't specific enough, so I had to hardcode
anyas the return type for the getter.To fix that, I think a couple things need to happen:
Something similar to this:
unfortunately,
OnboardingProfiledoes need to be more specific thanRecord<string, unknown>, because the consumers need more type info to compile correctly. (Otherwise I would have just added the record type to fix it in that PR!)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.
I didn't want to get into that myself, since I'm not familiar with the area. Is that something someone in this PR could take a look at?
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.
@noahtallen Thanks for letting us know 🙌 How urgent is this fix? Is it blocking a time-sensitive change?
@daledupreez I think Serenity now owns the Woo onboarding flow, is adjusting the types here something you can pick up? Is this code still used?
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.
Nope, it's not urgent! In the worst case, we just continue not having the right types here. Since (i guess) this has been working in prod for a while, it's not a customer-facing issue. I think the code itself works correctly, it's just that the types don't quite line up.