-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Countries from GraphQL #1993
Countries from GraphQL #1993
Conversation
packages/peregrine/lib/store/actions/checkout/__tests__/asyncActions.spec.js
Show resolved
Hide resolved
|
…studio into supernova/144_gql_countries
This is a |
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.
Good work! Only a few things before this can get approved methinks.
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.
Sorry, I just realized we have a potential bug so I want to get that remedied before we move this along.
|
||
const { data } = useQuery(countriesQuery); | ||
|
||
const { countries } = data || {}; |
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.
Now that I read this I realize in the past we would make requests for country data in the beginCheckout
async action which was await
ed in the initial opening of the submission form. This means that we don't render the form until we already have the data.
Now, we could possibly render with an empty object for countries
which may be incorrect. I think this means you should add a loading spinner/state and use that when countries is empty (or null/undefined). In this case it's probably safe to just return data
since it'll be undefined until then and we can block render until we get an error or it's finished loading.
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.
Resolved in 4a253fe.
Loading:
(don't worry about the slow spinner image loading, that's unrelated)
Error:
Let me know what you think of the implementation for sure.
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'm happy with this! While we did discuss passing invokers to thunks in some cases this particular case doesn't seem necessary. Keeping the query/data as local state to the checkout form is fine.
Good job!
Description
This PR updates Venia to fetch countries data from GraphQL instead of the REST endpoint.
Related Issue
PWA-144.
Acceptance
Verification Stakeholders
@sirugh @jimbo @tjwiebell @revanth0212
Specification
Verification Steps
State Validation Still Works
Submit Order Still Works
Screenshots / Screen Captures (if appropriate)
Checklist