Skip to content

Commit ae8ae67

Browse files
fix: limit order gasless cancel show wrong status (#2397)
1 parent 9629e81 commit ae8ae67

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/components/swapv2/LimitOrder/ListOrder/useRequestCancelOrder.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,12 @@ export const useProcessCancelOrder = ({
254254
if (signal.aborted) return
255255
setCancelStatus(gasLessCancel ? CancelStatus.COUNTDOWN : CancelStatus.WAITING)
256256
const expired = data?.orders?.[0]?.operatorSignatureExpiredAt
257-
if (expired) setExpiredTime(expired)
258-
else onDismiss()
257+
if (expired) {
258+
setExpiredTime(expired)
259+
if (expired * 1000 < Date.now()) {
260+
isEdit ? onDismiss() : setCancelStatus(CancelStatus.CANCEL_DONE)
261+
}
262+
} else onDismiss()
259263
} catch (error) {
260264
if (signal.aborted) return
261265
setExpiredTime(0)

src/components/swapv2/LimitOrder/Modals/CancelButtons.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ const CancelButtons = ({
166166
</ButtonWrapper>
167167
)
168168

169-
const propsGasless = {
170-
color: cancelType === CancelOrderType.GAS_LESS_CANCEL ? theme.primary : undefined,
171-
height: '40px',
172-
width: '100%',
173-
}
169+
const propsGasless = { height: '40px', width: '100%' }
174170
const propsHardCancel = { style: { height: '40px', width: '100%' }, disabled: disabledHardCancel }
175171

176172
if (isCountDown)
@@ -217,6 +213,7 @@ const CancelButtons = ({
217213
>
218214
<ButtonOutlined
219215
{...propsGasless}
216+
color={cancelType === CancelOrderType.GAS_LESS_CANCEL ? theme.primary : undefined}
220217
onClick={() => onSetType(CancelOrderType.GAS_LESS_CANCEL)}
221218
$disabled={disabledGasLessCancel}
222219
disabled={disabledGasLessCancel}

0 commit comments

Comments
 (0)