Skip to content

Commit

Permalink
Merge pull request #154 from vtex-apps/fix/ui-add-upload
Browse files Browse the repository at this point in the history
fix:  Bug fixed on UI adding to cart flow
  • Loading branch information
arturmagalhaesjr committed Feb 14, 2023
2 parents ff58bb7 + 266327c commit 5a760e1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Bug fixed on UI adding to cart flow


### Added

- [ENGINEERS-989] - Added verify the excel file testcase in cypress
Expand Down
2 changes: 2 additions & 0 deletions messages/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
"store/quickorder.validate": "Validasi",
"store/quickorder.withoutPriceFulfillment": "Produk tanpa harga",
"store/quickorder.withoutStock": "Tanpa stok",
"store/quickorder.limited": "Restricted Item",
"store/quickorder.partiallyAvailable": "Max quantity is {quantity}. Only {totalQuantity} total units available.",
"store/toaster.cart.duplicated": "Item diduplikat",
"store/toaster.cart.error": "Terjadi kesalahan saat menambahkan produk ke troli",
"store/toaster.cart.seeCart": "Lihat troli",
Expand Down
2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@gocommerce/utils": "^0.7.3",
"@vtex/api": "6.45.12",
"@vtex/api": "6.45.15",
"atob": "^2.1.2",
"axios": "^0.19.0",
"camelcase": "^5.0.0",
Expand Down
10 changes: 5 additions & 5 deletions node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1863,10 +1863,10 @@
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d"
integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg==

"@vtex/api@6.45.12":
version "6.45.12"
resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.45.12.tgz#b13c04398b12f576263ea823369f09c970d57479"
integrity sha512-SVLKo+Q/TxQy+1UKzH8GswTI3F2OCRCLfgaNQOrVAVdbM6Ci4wzTeX8j/S4Q1aEEnqBFlH/wVpHf8I6NBa+g9A==
"@vtex/api@6.45.15":
version "6.45.15"
resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.45.15.tgz#aa987d22f7df16ce2861130deda6ffd63156817b"
integrity sha512-Rg1VGDzJ4hHUNp1vSidMdGGPojr1PikMTptlZsJ3oNZVdEo4cPx2l8ZcAEwHWORL7QjPjXaEgmeA5ZOSf+boCQ==
dependencies:
"@types/koa" "^2.11.0"
"@types/koa-compose" "^3.2.3"
Expand Down Expand Up @@ -6055,7 +6055,7 @@ static-extend@^0.1.1:
define-property "^0.2.5"
object-copy "^0.1.0"

stats-lite@vtex/node-stats-lite#dist:
"stats-lite@github:vtex/node-stats-lite#dist":
version "2.2.0"
resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797"
dependencies:
Expand Down
6 changes: 2 additions & 4 deletions react/UploadBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { FunctionComponent } from 'react'
import React, { useState, useContext } from 'react'
import type { WrappedComponentProps } from 'react-intl'
import { FormattedMessage, injectIntl } from 'react-intl'
import { Button, Dropzone, ToastContext, Spinner } from 'vtex.styleguide'
import { Button, Dropzone, ToastContext } from 'vtex.styleguide'
import { OrderForm } from 'vtex.order-manager'
import type { OrderForm as OrderFormType } from 'vtex.checkout-graphql'
import { addToCart as ADD_TO_CART } from 'vtex.checkout-resources/Mutations'
Expand Down Expand Up @@ -227,7 +227,6 @@ const UploadBlock: FunctionComponent<
const loopCount = Math.floor(items.length / splitBy) + 1

const promises: any = []
// let orderFormData = []

for (let i = 0; i < loopCount; i++) {
const chunk = tempItems.splice(0, splitBy)
Expand Down Expand Up @@ -442,12 +441,11 @@ const UploadBlock: FunctionComponent<
>
<FormattedMessage id="store/quickorder.back" />
</Button>
{refidLoading && <Spinner />}
{showAddToCart && (
<Button
variation="primary"
size="small"
isLoading={mutationLoading}
isLoading={mutationLoading || refidLoading}
onClick={() => {
addToCartUpload()
}}
Expand Down
3 changes: 1 addition & 2 deletions react/components/ReviewBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,12 @@ const ReviewBlock: FunctionComponent<WrappedComponentProps & any> = ({
try {
const { data } = await client.query(query)

validateRefids(data, reviewed)
await validateRefids(data, reviewed)
onRefidLoading(false)
} catch (err) {
showToast({
message: intl.formatMessage(messages.cannotGetSkuInfo),
})

backList()
}
}
Expand Down

0 comments on commit 5a760e1

Please sign in to comment.