-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from vtex-apps/fix/broken-order-form
Fix broken order forms
- Loading branch information
Showing
6 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,11 +188,19 @@ export const queries = { | |
cacheControl.noCache = true | ||
cacheControl.noStore = true | ||
|
||
const { data: newOrderForm, headers } = await clients.checkout.orderFormRaw( | ||
let { data: newOrderForm, headers } = await clients.checkout.orderFormRaw( | ||
orderFormId ?? undefined, | ||
refreshOutdatedData ?? undefined | ||
) | ||
|
||
const hasBrokenCookie = newOrderForm?.clientProfileData?.email?.startsWith('vrn--vtexsphinx--aws-us-east-1') | ||
if (hasBrokenCookie) { | ||
vtex.logger.info({message: "Broken order form", orderFormId}) | ||
const obj = await clients.checkoutNoCookies.orderFormRaw(undefined, true) | ||
newOrderForm = obj.data | ||
headers = obj.headers | ||
} | ||
|
||
/** | ||
* In case the enableOrderFormOptimization setting is enabled in the store, | ||
* this will be the only `orderForm` query performed in the client. So no | ||
|
@@ -202,7 +210,7 @@ export const queries = { | |
const storeSettings: StoreSettings = await clients.apps.getAppSettings( | ||
'[email protected]' | ||
) | ||
if (storeSettings.enableOrderFormOptimization) { | ||
if (storeSettings.enableOrderFormOptimization || hasBrokenCookie) { | ||
forwardCheckoutCookies(headers, ctx) | ||
} | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1597,10 +1597,10 @@ | |
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" | ||
integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg== | ||
|
||
"@vtex/[email protected].0": | ||
version "6.45.0" | ||
resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.45.0.tgz#6f7de4b5e2f2a86cc8251125cc2d77de96611951" | ||
integrity sha512-F5mZLq/x8RrCXl6Qj+gJsqsyM1DGicxggZplitY3NOewn0vGXtz7TR2r/zY3v+9nQp+ksQzax7Vqf9em+78GxA== | ||
"@vtex/[email protected].3": | ||
version "6.45.3" | ||
resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.45.3.tgz#fe7d08adb4eab1fda5e34143cc6302a4c5aa5f52" | ||
integrity sha512-kiD7We1TCKDyBdpYoh2Se3An+jTJRUzXGNpKifoDZylWQ1PyIx+3oL5ZAif9InlY3uJkfEisSAI6nxoKTgvPfw== | ||
dependencies: | ||
"@types/koa" "^2.11.0" | ||
"@types/koa-compose" "^3.2.3" | ||
|