Skip to content

Commit

Permalink
Merge pull request #98 from vtex/bugfix/S2BRFPA-970-edit-page
Browse files Browse the repository at this point in the history
Bugfix/s2 brfpa 970 edit page
  • Loading branch information
MIzidio authored Sep 12, 2022
2 parents 55f1060 + c5f0260 commit 0cc3ff0
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 38 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]

### 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
Expand Down
6 changes: 3 additions & 3 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"vtex.affiliates-order-form-spy": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.affiliates-order-form-spy",
"vtex.breadcrumb": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.breadcrumb",
"vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.css-handles",
"vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.flex-layout",
"vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.flex-layout",
"vtex.order-manager": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.order-manager",
"vtex.product-summary": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.product-summary",
"vtex.responsive-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.responsive-layout",
"vtex.rich-text": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.rich-text",
"vtex.search-result": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.search-result",
"vtex.session-client": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.session-client",
"vtex.store": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store",
"vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.store-components",
"vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].2/public/@types/vtex.store-components",
"vtex.store-icons": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store-icons",
"vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.styleguide"
"vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].3/public/@types/vtex.styleguide"
},
"scripts": {
"lint": "tsc --noEmit --pretty",
Expand Down
18 changes: 9 additions & 9 deletions node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6231,9 +6231,9 @@ [email protected]:
version "1.0.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.css-handles#336b23ef3a9bcb2b809529ba736783acd405d081"

"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.flex-layout":
version "0.20.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.flex-layout#70a7b1b6dda96a6ae16b80e5c3e6b263e1f38631"
"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.flex-layout":
version "0.20.1"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.flex-layout#dce9424c910091f0ba1f5229ce8ae80c9f7b7765"

"vtex.order-manager@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.order-manager":
version "0.12.0"
Expand All @@ -6259,9 +6259,9 @@ [email protected]:
version "1.0.2"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.session-client#239ac9935a59699e62e1509f844de81544ed0877"

"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.store-components":
version "3.162.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.store-components#c3e4fac4893627ab0f2fc3ad88d697c3ab7bf6c8"
"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].2/public/@types/vtex.store-components":
version "3.162.2"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].2/public/@types/vtex.store-components#f065b741b78c044c2f5f6549b6c1b1afd5a227c7"

"vtex.store-icons@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store-icons":
version "0.18.0"
Expand All @@ -6271,9 +6271,9 @@ [email protected]:
version "2.127.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store#d78eafaef1ea6f4e87cbc7adc869bff44e437329"

"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.styleguide":
version "9.146.1"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.styleguide#66db40ca1b78ad77ce4beedabecee320e1ef2ead"
"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].3/public/@types/vtex.styleguide":
version "9.146.3"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb"

w3c-hr-time@^1.0.1:
version "1.0.2"
Expand Down
27 changes: 18 additions & 9 deletions react/AffiliateEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -34,14 +36,15 @@ const AffiliateEditPage: FC = () => {

const intl = useIntl()

const { data } = useQuery<AffiliateQueryReturn, QueryGetAffiliateArgs>(
GET_AFFILIATE,
{
variables: {
affiliateId,
},
}
)
const { data, loading } = useQuery<
AffiliateQueryReturn,
QueryGetAffiliateArgs
>(GET_AFFILIATE, {
variables: {
affiliateId,
},
notifyOnNetworkStatusChange: true,
})

const handleBackAction = () => {
navigate({
Expand All @@ -64,7 +67,13 @@ const AffiliateEditPage: FC = () => {
</PageHeaderTop>
</PageHeader>
<PageContent>
<AffiliateForm affiliate={data?.getAffiliate} />
{loading ? (
<Flex justify="center">
<Spinner size={72} />
</Flex>
) : (
<AffiliateForm affiliate={data?.getAffiliate} />
)}
</PageContent>
</Page>
</ToastProvider>
Expand Down
10 changes: 5 additions & 5 deletions react/components/admin/dashboard/AffiliateOrdersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 === '') {
Expand Down Expand Up @@ -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 <Skeleton csx={{ height: 24 }} />
}

Expand All @@ -295,7 +295,7 @@ const AffiliateOrdersTable: FC = () => {
header: intl.formatMessage(
messages.affiliatesOrdersTableStatusColumnLabel
),
width: 200,
width: 210,
resolver: {
type: 'root',
render: StatusTableCell,
Expand Down
6 changes: 3 additions & 3 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"vtex.affiliates-order-form-spy": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.affiliates-order-form-spy",
"vtex.breadcrumb": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.breadcrumb",
"vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.css-handles",
"vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.flex-layout",
"vtex.flex-layout": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.flex-layout",
"vtex.order-manager": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.order-manager",
"vtex.product-summary": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.product-summary",
"vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.render-runtime",
Expand All @@ -46,8 +46,8 @@
"vtex.search-result": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.search-result",
"vtex.session-client": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.session-client",
"vtex.store": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store",
"vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.store-components",
"vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].2/public/@types/vtex.store-components",
"vtex.store-icons": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store-icons",
"vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.styleguide"
"vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].3/public/@types/vtex.styleguide"
}
}
18 changes: 9 additions & 9 deletions react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5814,9 +5814,9 @@ [email protected]:
version "1.0.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.css-handles#336b23ef3a9bcb2b809529ba736783acd405d081"

"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.flex-layout":
version "0.20.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.flex-layout#70a7b1b6dda96a6ae16b80e5c3e6b263e1f38631"
"vtex.flex-layout@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.flex-layout":
version "0.20.1"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.flex-layout#dce9424c910091f0ba1f5229ce8ae80c9f7b7765"

"vtex.order-manager@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.order-manager":
version "0.12.0"
Expand Down Expand Up @@ -5846,9 +5846,9 @@ [email protected]:
version "1.0.2"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.session-client#239ac9935a59699e62e1509f844de81544ed0877"

"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.store-components":
version "3.162.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].0/public/@types/vtex.store-components#c3e4fac4893627ab0f2fc3ad88d697c3ab7bf6c8"
"vtex.store-components@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].2/public/@types/vtex.store-components":
version "3.162.2"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].2/public/@types/vtex.store-components#f065b741b78c044c2f5f6549b6c1b1afd5a227c7"

"vtex.store-icons@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store-icons":
version "0.18.0"
Expand All @@ -5858,9 +5858,9 @@ [email protected]:
version "2.127.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store#d78eafaef1ea6f4e87cbc7adc869bff44e437329"

"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.styleguide":
version "9.146.1"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].1/public/@types/vtex.styleguide#66db40ca1b78ad77ce4beedabecee320e1ef2ead"
"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].3/public/@types/vtex.styleguide":
version "9.146.3"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected].3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb"

w3c-hr-time@^1.0.1:
version "1.0.2"
Expand Down

0 comments on commit 0cc3ff0

Please sign in to comment.