Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #71 from arthyn/fix/eject-failing
Browse files Browse the repository at this point in the history
fix eject failing randomly
  • Loading branch information
arthyn authored May 7, 2021
2 parents bc868dd + 0b48ec1 commit da46d2d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/renderer/ship/Ship.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ export const Ship: React.FC = () => {
}
})
const { mutate: ejectShip, isLoading } = useMutation(async () => {
await send('stop-pier', ship)
return send('eject-pier', ship)
const pier = await send('stop-pier', ship)

//we wait here in case .vere.lock hasn't cleared yet (race condition)
return new Promise<void>((resolve) => {
setTimeout(async () => {
await send('eject-pier', pier)
resolve();
}, 2000)
})
}, {
onSuccess: () => {
queryClient.prefetchQuery(pierKey())
Expand Down

0 comments on commit da46d2d

Please sign in to comment.