Skip to content

Commit

Permalink
wip: always resolve form actions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbira committed Sep 4, 2024
1 parent d23da08 commit c7743a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -109,15 +109,15 @@ 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

# Deploy!
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 }}
Expand Down
6 changes: 3 additions & 3 deletions components/forms/FormWithAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ export function FormWithAction({
const [isPending, startTransition] = useTransition()
const wrappedAction = useCallback(
(prevState: FormPassBackState, formData: FormData): Promise<FormPassBackState> => {
return new Promise(async (resolve, reject) => {
return new Promise(async (resolve, _reject) => {
startTransition(async () => {
try {
const res = await action(prevState, formData)
if (res.status === "success") {
onSuccess?.(res)
}
resolve(res)
} catch (e) {
reject(e)
} catch (e: any) {
resolve({ status: "error", message: e.message })
}
})
})
Expand Down

0 comments on commit c7743a7

Please sign in to comment.