Skip to content

Commit

Permalink
reset input to trade every time (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
aforaleka authored Apr 30, 2024
1 parent b85ead0 commit bfe5f2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useTriggerOrdersFormInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const useTriggerOrdersFormInputs = ({
}

return () => {
abacusStateManager.clearTriggerOrdersInputValues();
abacusStateManager.resetInputState();
};
}, []);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/abacus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class AbacusStateManager {
field: TransferInputField.type,
value: null,
});
this.clearTradeInputValues();
this.clearTriggerOrdersInputValues();
this.clearTradeInputValues({ shouldResetSize: true });
};

// ------ Set Data ------ //
Expand Down
7 changes: 7 additions & 0 deletions src/views/forms/AccountManagementForms/TestnetDepositForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { calculateCanAccountTrade } from '@/state/accountCalculators';
import { getSubaccount } from '@/state/accountSelectors';
import { getSelectedNetwork } from '@/state/appSelectors';

import abacusStateManager from '@/lib/abacus';
import { log } from '@/lib/telemetry';

type DepositFormProps = {
Expand All @@ -43,6 +44,12 @@ export const TestnetDepositForm = ({ onDeposit, onError }: DepositFormProps) =>
}
}, [subAccount]);

useEffect(() => {
return () => {
abacusStateManager.resetInputState();
};
}, []);

return (
<Styled.Form
onSubmit={async (e: FormEvent) => {
Expand Down

0 comments on commit bfe5f2e

Please sign in to comment.