From a71547d77287dfd71fba522bee986ab27cced001 Mon Sep 17 00:00:00 2001 From: KONFeature Date: Mon, 6 Jan 2025 15:01:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20product=20information=20fe?= =?UTF-8?q?tching=20failing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 24 ++++++++++++------- .../hooks/useOnGetProductInformation.ts | 22 +++++++++++++---- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9e3a99b4..5153833c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,6 +2,12 @@ name: 🚀 Deploy on: workflow_dispatch: + inputs: + force_deploy: + description: 'Force the deployment (even if no file changes)' + required: true + type: boolean + default: false push: branches: - main @@ -50,27 +56,27 @@ jobs: - 'packages/backend-elysia/**' - name: Set up QEMU - if: steps.changes.outputs.backend == 'true' + if: steps.changes.outputs.backend == 'true' || github.event.inputs.force_deploy == 'true' uses: docker/setup-qemu-action@v3 with: platforms: linux/arm64 - name: Set up Docker Buildx - if: steps.changes.outputs.backend == 'true' + if: steps.changes.outputs.backend == 'true' || github.event.inputs.force_deploy == 'true' uses: docker/setup-buildx-action@v3 with: platforms: linux/arm64 - name: "🔨 Install dependencies" - if: steps.changes.outputs.deployRequired == 'true' + if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true' run: bun install --frozen-lockfile - name: "🔨 Build the SDK" - if: steps.changes.outputs.deployRequired == 'true' + if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true' run: bun run build:sdk - name: "👥 Configure AWS Credentials" - if: steps.changes.outputs.deployRequired == 'true' + if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true' uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::262732185023:role/github-action-deploy-role @@ -78,12 +84,12 @@ jobs: retry-max-attempts: 5 - name: "👥 Login to Amazon ECR" - if: steps.changes.outputs.deployRequired == 'true' + if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true' id: login-ecr uses: aws-actions/amazon-ecr-login@v2 - name: "🔧 Setup environment" - if: steps.changes.outputs.deployRequired == 'true' + if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true' shell: bash run: | if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then @@ -105,7 +111,7 @@ jobs: echo "Backend image tag : ${{ env.BACKEND_IMAGE_TAG }}" - name: "🔨 Build Elysia backend" - if: steps.changes.outputs.backend == 'true' + if: steps.changes.outputs.backend == 'true' || github.event.inputs.force_deploy == 'true' uses: docker/build-push-action@v6 with: file: ./infra/docker/ElysiaDockerfile @@ -123,7 +129,7 @@ jobs: STAGE: ${{ env.STAGE }} - name: "🚀 SST Deploy" - if: steps.changes.outputs.deployRequired == 'true' + if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true' run: | STAGE=${STAGE_OVERRIDE:-$STAGE} echo "Deploying with stage: $STAGE" diff --git a/packages/wallet/app/module/listener/hooks/useOnGetProductInformation.ts b/packages/wallet/app/module/listener/hooks/useOnGetProductInformation.ts index f05e854b..4ff6304c 100644 --- a/packages/wallet/app/module/listener/hooks/useOnGetProductInformation.ts +++ b/packages/wallet/app/module/listener/hooks/useOnGetProductInformation.ts @@ -22,14 +22,20 @@ type OnGetProductInformation = IFrameRequestResolver< */ export function useOnGetProductInformation(): OnGetProductInformation { const productId = useAtomValue(listenerProductIdAtom); - const { promise: estimatedRewardAsync } = useEstimatedInteractionReward(); - const { promise: productMetadataAsync } = useGetProductMetadata(); + const { + estimatedReward: initialEstimatedReward, + refetch: refetchEstimatedReward, + } = useEstimatedInteractionReward(); + const { + metadata: initialProductMetadata, + refetch: refetchProductMetadata, + } = useGetProductMetadata(); return useCallback( async (_request, _context, emitter) => { const [estimatedReward, productMetadata] = await Promise.all([ - estimatedRewardAsync, - productMetadataAsync, + initialEstimatedReward ?? (await refetchEstimatedReward()).data, + initialProductMetadata ?? (await refetchProductMetadata()).data, ]); if (!(productId && productMetadata)) { @@ -51,6 +57,12 @@ export function useOnGetProductInformation(): OnGetProductInformation { }, }); }, - [productId, estimatedRewardAsync, productMetadataAsync] + [ + productId, + initialEstimatedReward, + initialProductMetadata, + refetchEstimatedReward, + refetchProductMetadata, + ] ); }