Skip to content

Commit

Permalink
fix: barrier value on trade type change issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhy-Deriv committed Aug 7, 2024
1 parent 9b88e2d commit 35f9b38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/javascript/app/pages/form/barrier-fields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,12 @@ const BarrierFields = ({ formName, handleAmountChange }) => {
return (
<>
{['touchnotouch', 'higherlower'].includes(formName) &&
barrier_data?.show_barrier &&
barrier && (
barrier_data?.show_barrier && (
<div className='quill-form-row'>
<div className={`form_field ${!barrier_data?.isOffset ? 'field-pb' : ''}`}>
<TextField
label={barrier_data.label}
value={barrier}
value={barrier ?? ''}
type={barrier_data?.isOffset ? 'text' : 'number'}
allowDecimals
rightIcon={barrier_data?.isOffset && barrierIcon}
Expand All @@ -94,14 +93,13 @@ const BarrierFields = ({ formName, handleAmountChange }) => {
)}

{['endsinout', 'staysinout'].includes(formName) &&
barrier_data?.show_barrier_highlow &&
barrier_high && barrier_low && (
barrier_data?.show_barrier_highlow && (
<>
<div className='quill-form-row'>
<div className={`form_field ${!barrier_data?.isOffsetHightLow ? 'field-pb' : ''}`}>
<TextField
label={barrier_data.label_high}
value={barrier_high}
value={barrier_high ?? ''}
type={barrier_data?.isOffsetHightLow ? 'text' : 'number'}
allowDecimals
rightIcon={barrier_data?.isOffsetHightLow && barrierIcon}
Expand All @@ -118,7 +116,7 @@ const BarrierFields = ({ formName, handleAmountChange }) => {
<div className={`form_field ${!barrier_data?.isOffsetHightLow ? 'field-pb' : ''}`}>
<TextField
label={barrier_data.label_low}
value={barrier_low}
value={barrier_low ?? ''}
type={barrier_data?.isOffsetHightLow ? 'text' : 'number'}
allowDecimals
rightIcon={barrier_data?.isOffsetHightLow && barrierIcon}
Expand Down
4 changes: 3 additions & 1 deletion src/javascript/app/pages/trade/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const Defaults = (() => {
// to increase speed, do not set values when form is still loading
if (!isVisible(getElementById('trading_init_progress'))) {
sessionStorage.setItem(key, value);
triggerSessionChange();
if (!['barrier', 'barrier_high', 'barrier_low'].includes(key)) {
triggerSessionChange();
}
updateURL();
}
}
Expand Down

0 comments on commit 35f9b38

Please sign in to comment.