From f8a6edc3c6498a298dadbd0b5ea4f5c97730ebb8 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro <enzo-vezzaro@live.it> Date: Tue, 23 Aug 2022 07:08:12 -0400 Subject: [PATCH 1/4] fix publishing when connecting wallet on publish form --- src/components/Publish/Steps.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Publish/Steps.tsx b/src/components/Publish/Steps.tsx index 6ec733cab..c35d6a260 100644 --- a/src/components/Publish/Steps.tsx +++ b/src/components/Publish/Steps.tsx @@ -1,9 +1,14 @@ import { ReactElement, useEffect } from 'react' import { useFormikContext } from 'formik' -import { wizardSteps, initialPublishFeedback } from './_constants' +import { + wizardSteps, + initialPublishFeedback, + initialValues +} from './_constants' import { useWeb3 } from '@context/Web3' import { FormPublishData, PublishFeedback } from './_types' import { getOceanConfig } from '@utils/ocean' +import router from 'next/router' export function Steps({ feedback @@ -22,11 +27,15 @@ export function Steps({ setFieldValue('user.accountId', accountId) }, [chainId, accountId, setFieldValue]) - // Reset the selected baseToken on chainId change useEffect(() => { if (!chainId) return - setFieldValue('pricing.baseToken', null) + // Reset the pricing values on chainId change + // the user needs to update the pricing schema on network changes + if (values.pricing.price) { + setFieldValue('pricing', initialValues.pricing) + router.push(`/publish/3`) + } }, [chainId, setFieldValue]) // auto-sync publish feedback into form data values From 245ccfe5e4044c3c54ca64aa404f8a99d35f91ec Mon Sep 17 00:00:00 2001 From: EnzoVezzaro <enzo-vezzaro@live.it> Date: Wed, 24 Aug 2022 06:22:57 -0400 Subject: [PATCH 2/4] fix reset pricing on tx execution --- src/components/Publish/Steps.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Publish/Steps.tsx b/src/components/Publish/Steps.tsx index c35d6a260..ece8d4607 100644 --- a/src/components/Publish/Steps.tsx +++ b/src/components/Publish/Steps.tsx @@ -30,9 +30,10 @@ export function Steps({ useEffect(() => { if (!chainId) return - // Reset the pricing values on chainId change - // the user needs to update the pricing schema on network changes - if (values.pricing.price) { + // Reset the pricing values on chainId change: + // - the user needs to update the pricing schema on network changes + // - if the tx has been started, don't restore pricing values + if (values.pricing.price && values.feedback[1].status === 'pending') { setFieldValue('pricing', initialValues.pricing) router.push(`/publish/3`) } From 419234ab64f1dc21af29c10aae4d585a5cd92bf6 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro <enzo-vezzaro@live.it> Date: Wed, 24 Aug 2022 06:52:32 -0400 Subject: [PATCH 3/4] removed changing steps --- src/components/Publish/Steps.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/components/Publish/Steps.tsx b/src/components/Publish/Steps.tsx index ece8d4607..51a0fa753 100644 --- a/src/components/Publish/Steps.tsx +++ b/src/components/Publish/Steps.tsx @@ -27,18 +27,6 @@ export function Steps({ setFieldValue('user.accountId', accountId) }, [chainId, accountId, setFieldValue]) - useEffect(() => { - if (!chainId) return - - // Reset the pricing values on chainId change: - // - the user needs to update the pricing schema on network changes - // - if the tx has been started, don't restore pricing values - if (values.pricing.price && values.feedback[1].status === 'pending') { - setFieldValue('pricing', initialValues.pricing) - router.push(`/publish/3`) - } - }, [chainId, setFieldValue]) - // auto-sync publish feedback into form data values useEffect(() => { setFieldValue('feedback', feedback) From 7a3c7a992755d1d210e2c8c3f33482abad1a6122 Mon Sep 17 00:00:00 2001 From: EnzoVezzaro <enzo-vezzaro@live.it> Date: Wed, 24 Aug 2022 11:12:53 -0400 Subject: [PATCH 4/4] cleanup --- src/components/Publish/Steps.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/Publish/Steps.tsx b/src/components/Publish/Steps.tsx index 51a0fa753..4c3e2a338 100644 --- a/src/components/Publish/Steps.tsx +++ b/src/components/Publish/Steps.tsx @@ -1,14 +1,9 @@ import { ReactElement, useEffect } from 'react' import { useFormikContext } from 'formik' -import { - wizardSteps, - initialPublishFeedback, - initialValues -} from './_constants' +import { wizardSteps, initialPublishFeedback } from './_constants' import { useWeb3 } from '@context/Web3' import { FormPublishData, PublishFeedback } from './_types' import { getOceanConfig } from '@utils/ocean' -import router from 'next/router' export function Steps({ feedback