From a0984fa43d2fcf614976dd307103471ca6c35336 Mon Sep 17 00:00:00 2001 From: Matheus Izidio Date: Fri, 9 Sep 2022 16:53:06 -0300 Subject: [PATCH 1/4] vtex setup --- node/package.json | 6 +++--- node/yarn.lock | 18 +++++++++--------- react/package.json | 6 +++--- react/yarn.lock | 18 +++++++++--------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/node/package.json b/node/package.json index 20f9479..1862483 100644 --- a/node/package.json +++ b/node/package.json @@ -18,7 +18,7 @@ "vtex.affiliates-order-form-spy": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.affiliates-order-form-spy@0.1.2/public/@types/vtex.affiliates-order-form-spy", "vtex.breadcrumb": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.breadcrumb@1.9.4/public/@types/vtex.breadcrumb", "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles", - "vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.0/public/@types/vtex.flex-layout", + "vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.1/public/@types/vtex.flex-layout", "vtex.order-manager": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.12.0/public/@types/vtex.order-manager", "vtex.product-summary": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary@2.80.1/public/@types/vtex.product-summary", "vtex.responsive-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.responsive-layout@0.1.2/public/@types/vtex.responsive-layout", @@ -26,9 +26,9 @@ "vtex.search-result": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-result@3.118.14/public/@types/vtex.search-result", "vtex.session-client": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.session-client@1.0.2/public/@types/vtex.session-client", "vtex.store": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.127.0/public/@types/vtex.store", - "vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.0/public/@types/vtex.store-components", + "vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.2/public/@types/vtex.store-components", "vtex.store-icons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-icons@0.18.0/public/@types/vtex.store-icons", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide" + "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide" }, "scripts": { "lint": "tsc --noEmit --pretty", diff --git a/node/yarn.lock b/node/yarn.lock index c5aefde..de2b43c 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6231,9 +6231,9 @@ verror@1.10.0: version "1.0.0" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles#336b23ef3a9bcb2b809529ba736783acd405d081" -"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.0/public/@types/vtex.flex-layout": - version "0.20.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.0/public/@types/vtex.flex-layout#70a7b1b6dda96a6ae16b80e5c3e6b263e1f38631" +"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.1/public/@types/vtex.flex-layout": + version "0.20.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.1/public/@types/vtex.flex-layout#dce9424c910091f0ba1f5229ce8ae80c9f7b7765" "vtex.order-manager@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.12.0/public/@types/vtex.order-manager": version "0.12.0" @@ -6259,9 +6259,9 @@ verror@1.10.0: version "1.0.2" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.session-client@1.0.2/public/@types/vtex.session-client#239ac9935a59699e62e1509f844de81544ed0877" -"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.0/public/@types/vtex.store-components": - version "3.162.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.0/public/@types/vtex.store-components#c3e4fac4893627ab0f2fc3ad88d697c3ab7bf6c8" +"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.2/public/@types/vtex.store-components": + version "3.162.2" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.2/public/@types/vtex.store-components#f065b741b78c044c2f5f6549b6c1b1afd5a227c7" "vtex.store-icons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-icons@0.18.0/public/@types/vtex.store-icons": version "0.18.0" @@ -6271,9 +6271,9 @@ verror@1.10.0: version "2.127.0" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.127.0/public/@types/vtex.store#d78eafaef1ea6f4e87cbc7adc869bff44e437329" -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide": - version "9.146.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide#66db40ca1b78ad77ce4beedabecee320e1ef2ead" +"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": + version "9.146.3" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" w3c-hr-time@^1.0.1: version "1.0.2" diff --git a/react/package.json b/react/package.json index 8cdc0db..327011b 100644 --- a/react/package.json +++ b/react/package.json @@ -37,7 +37,7 @@ "vtex.affiliates-order-form-spy": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.affiliates-order-form-spy@0.1.2/public/@types/vtex.affiliates-order-form-spy", "vtex.breadcrumb": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.breadcrumb@1.9.4/public/@types/vtex.breadcrumb", "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles", - "vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.0/public/@types/vtex.flex-layout", + "vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.1/public/@types/vtex.flex-layout", "vtex.order-manager": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.12.0/public/@types/vtex.order-manager", "vtex.product-summary": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.product-summary@2.80.1/public/@types/vtex.product-summary", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", @@ -46,8 +46,8 @@ "vtex.search-result": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.search-result@3.118.14/public/@types/vtex.search-result", "vtex.session-client": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.session-client@1.0.2/public/@types/vtex.session-client", "vtex.store": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.127.0/public/@types/vtex.store", - "vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.0/public/@types/vtex.store-components", + "vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.2/public/@types/vtex.store-components", "vtex.store-icons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-icons@0.18.0/public/@types/vtex.store-icons", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide" + "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide" } } diff --git a/react/yarn.lock b/react/yarn.lock index 87a3ee3..b9bfb54 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5814,9 +5814,9 @@ verror@1.10.0: version "1.0.0" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@1.0.0/public/@types/vtex.css-handles#336b23ef3a9bcb2b809529ba736783acd405d081" -"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.0/public/@types/vtex.flex-layout": - version "0.20.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.0/public/@types/vtex.flex-layout#70a7b1b6dda96a6ae16b80e5c3e6b263e1f38631" +"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.1/public/@types/vtex.flex-layout": + version "0.20.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.flex-layout@0.20.1/public/@types/vtex.flex-layout#dce9424c910091f0ba1f5229ce8ae80c9f7b7765" "vtex.order-manager@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.order-manager@0.12.0/public/@types/vtex.order-manager": version "0.12.0" @@ -5846,9 +5846,9 @@ verror@1.10.0: version "1.0.2" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.session-client@1.0.2/public/@types/vtex.session-client#239ac9935a59699e62e1509f844de81544ed0877" -"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.0/public/@types/vtex.store-components": - version "3.162.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.0/public/@types/vtex.store-components#c3e4fac4893627ab0f2fc3ad88d697c3ab7bf6c8" +"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.2/public/@types/vtex.store-components": + version "3.162.2" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.162.2/public/@types/vtex.store-components#f065b741b78c044c2f5f6549b6c1b1afd5a227c7" "vtex.store-icons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-icons@0.18.0/public/@types/vtex.store-icons": version "0.18.0" @@ -5858,9 +5858,9 @@ verror@1.10.0: version "2.127.0" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store@2.127.0/public/@types/vtex.store#d78eafaef1ea6f4e87cbc7adc869bff44e437329" -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide": - version "9.146.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide#66db40ca1b78ad77ce4beedabecee320e1ef2ead" +"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": + version "9.146.3" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" w3c-hr-time@^1.0.1: version "1.0.2" From 842911e29b496d5b99909e8d5adb014a08b8e3ad Mon Sep 17 00:00:00 2001 From: Matheus Izidio Date: Fri, 9 Sep 2022 16:53:35 -0300 Subject: [PATCH 2/4] add loading state --- react/AffiliateEditPage.tsx | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/react/AffiliateEditPage.tsx b/react/AffiliateEditPage.tsx index ed549aa..4ba281b 100644 --- a/react/AffiliateEditPage.tsx +++ b/react/AffiliateEditPage.tsx @@ -8,6 +8,8 @@ import { PageContent, createSystem, ToastProvider, + Spinner, + Flex, } from '@vtex/admin-ui' import { useRuntime } from 'vtex.render-runtime' import { useIntl } from 'react-intl' @@ -34,14 +36,15 @@ const AffiliateEditPage: FC = () => { const intl = useIntl() - const { data } = useQuery( - GET_AFFILIATE, - { - variables: { - affiliateId, - }, - } - ) + const { data, loading } = useQuery< + AffiliateQueryReturn, + QueryGetAffiliateArgs + >(GET_AFFILIATE, { + variables: { + affiliateId, + }, + notifyOnNetworkStatusChange: true, + }) const handleBackAction = () => { navigate({ @@ -64,7 +67,13 @@ const AffiliateEditPage: FC = () => { - + {loading ? ( + + + + ) : ( + + )} From c8a5058551d06db59f2618586d7b2b99b6709826 Mon Sep 17 00:00:00 2001 From: Matheus Izidio Date: Fri, 9 Sep 2022 16:54:22 -0300 Subject: [PATCH 3/4] add loading when the name is not ready --- .../admin/dashboard/AffiliateOrdersTable.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/react/components/admin/dashboard/AffiliateOrdersTable.tsx b/react/components/admin/dashboard/AffiliateOrdersTable.tsx index 196370a..458474f 100644 --- a/react/components/admin/dashboard/AffiliateOrdersTable.tsx +++ b/react/components/admin/dashboard/AffiliateOrdersTable.tsx @@ -207,14 +207,14 @@ const AffiliateOrdersTable: FC = () => { } affiliatesData?.getAffiliates?.data?.map((affiliate: Affiliate) => { - if (!dict.has(affiliate.id ?? '')) { - return dict.set(affiliate.id ?? '', affiliate.name ?? '') + if (affiliate.id && !dict.has(affiliate.id)) { + return dict.set(affiliate.id, affiliate.name ?? '') } return '' }) // eslint-disable-next-line react-hooks/exhaustive-deps - }, [affiliatesData, dict]) + }, [affiliatesData?.getAffiliates?.data, dict]) useEffect(() => { if (combobox.deferredValue === '') { @@ -278,7 +278,7 @@ const AffiliateOrdersTable: FC = () => { resolver: { type: 'root', render: ({ item, context }) => { - if (context.status === 'loading') { + if (context.status === 'loading' || !dict.get(item.affiliateId)) { return } @@ -295,7 +295,7 @@ const AffiliateOrdersTable: FC = () => { header: intl.formatMessage( messages.affiliatesOrdersTableStatusColumnLabel ), - width: 200, + width: 210, resolver: { type: 'root', render: StatusTableCell, From c5f026012d22b2f779bc6e1ac8c7fc5066f6d727 Mon Sep 17 00:00:00 2001 From: Matheus Izidio Date: Fri, 9 Sep 2022 16:59:54 -0300 Subject: [PATCH 4/4] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd8bfb6..eef6f8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- Loading spinner to edit page +- Loading to names on the affiliates orders table + ## [0.61.0] - 2022-09-02 ## [0.60.0] - 2022-09-01