diff --git a/.gitignore b/.gitignore index 6f14d09b0..a930064c5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ # IDE - VSCode .vscode/* -!.vscode/settings.json +.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json diff --git a/libs/deal-ticket/src/components/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket.spec.tsx index 59431d73c..cdb1f78ea 100644 --- a/libs/deal-ticket/src/components/deal-ticket.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket.spec.tsx @@ -163,7 +163,7 @@ describe('DealTicket', () => { // Change back to limit and check we are still on FOK fireEvent.click(screen.getByTestId('order-type-TYPE_LIMIT')); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.FOK + VegaWalletOrderTimeInForce.GTC ); }); }); diff --git a/libs/deal-ticket/src/components/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket.tsx index 4e3d3d4ee..98ed58ed3 100644 --- a/libs/deal-ticket/src/components/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket.tsx @@ -39,6 +39,7 @@ export const DealTicket = ({ handleSubmit, watch, formState: { errors }, + setValue, } = useForm({ mode: 'onChange', defaultValues: getDefaultOrder(market), @@ -71,7 +72,17 @@ export const DealTicket = ({ name="type" control={control} render={({ field }) => ( - + { + if (type === VegaWalletOrderType.Limit) { + setValue('timeInForce', VegaWalletOrderTimeInForce.GTC); + } else { + setValue('timeInForce', VegaWalletOrderTimeInForce.IOC); + } + field.onChange(type); + }} + /> )} />