From c7743a77dcc0b80473f7b59ddc384b8685ced095 Mon Sep 17 00:00:00 2001 From: Alexander Biraben-Renard Date: Wed, 4 Sep 2024 11:13:05 +0100 Subject: [PATCH] wip: always resolve form actions --- .github/workflows/build.yml | 14 +++++++------- components/forms/FormWithAction.tsx | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b910982..0577252e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,11 +10,11 @@ env: IMPAAS_APP_NAME: cpp-connect IMPAAS_DEPLOY_TOKEN: ${{ secrets.IMPAAS_DEPLOY_TOKEN }} -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] +on: [push] +# push: +# branches: ["main"] +# pull_request: +# branches: ["main"] jobs: lint: @@ -109,7 +109,7 @@ jobs: context: . # pushes regardless; only main tagged with latest push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }}, ghcr.io/imperial/cpp-connect:latest labels: ${{ steps.meta.outputs.labels }} no-cache: true @@ -117,7 +117,7 @@ jobs: deploy-impaas: needs: - build-and-push-image - if: github.ref == 'refs/heads/main' + # if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest env: TSURU_TOKEN: ${{ secrets.IMPAAS_DEPLOY_TOKEN }} diff --git a/components/forms/FormWithAction.tsx b/components/forms/FormWithAction.tsx index 1ccccf2f..bfc1fdb1 100644 --- a/components/forms/FormWithAction.tsx +++ b/components/forms/FormWithAction.tsx @@ -50,7 +50,7 @@ export function FormWithAction({ const [isPending, startTransition] = useTransition() const wrappedAction = useCallback( (prevState: FormPassBackState, formData: FormData): Promise => { - return new Promise(async (resolve, reject) => { + return new Promise(async (resolve, _reject) => { startTransition(async () => { try { const res = await action(prevState, formData) @@ -58,8 +58,8 @@ export function FormWithAction({ onSuccess?.(res) } resolve(res) - } catch (e) { - reject(e) + } catch (e: any) { + resolve({ status: "error", message: e.message }) } }) })