-
Notifications
You must be signed in to change notification settings - Fork 683
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
PWA-138: Re-factor getUserDetails to use GraphQL (useAwaitQuery Edition) #2004
Conversation
|
const userDetails = await request('/rest/V1/customers/me', { | ||
method: 'GET' | ||
}); | ||
const { data } = await fetch(); |
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.
This prevents other actions from calling each other as only components will have fetchers.
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.
Also we would want to ensure we handle the error appropriately. Does fetch
throw an error or would we have to destructure error
from the result?
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.
...you're absolutely right, and it would be nasty to have to pass query invokers for nested action calls, but it would more clearly define those action APIs.
fetch
does throw
on error, so this code should function as-is (though may need to destructure { error }
in the catch
.
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.
This does look cleaner. Please add some docs, otherwise 👍
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.
<3
QA
|
method: 'GET' | ||
const { data } = await fetchUserDetails({ | ||
// until we can investigate some odd behavior with apollo-cache-persist | ||
// not busting the cache on sign out, avoid caching user details. |
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.
@tjwiebell did we create a ticket for this?
Description
See PWA-138
Related Issue
Acceptance
Verification Stakeholders
Specification
Verification Steps
Screenshots / Screen Captures (if appropriate)
Checklist