Skip to content

Commit

Permalink
Resolve cell builder dynamic update issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulyadav-57 committed Jan 5, 2024
1 parent f6dea0e commit e404092
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/components/workspace/BuildProject/BuildProject.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@
gap: 0.2rem;
}
}
[class*='ant-form-item-explain-error'] {
position: relative;
top: -8px;
pointer-events: none;
.cellBuilder {
[class*='ant-form-item-explain-error'] {
position: relative;
top: -10px;
pointer-events: none;
}
}
}
33 changes: 22 additions & 11 deletions src/components/workspace/BuildProject/CellBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const CellBuilder: FC<Props> = ({ info, projectId, type, form }) => {
}, [isCellBuilder]);

return (
<div>
<div className={s.cellBuilder}>
<p className={s.info}>
- {info}
<OpenFile
Expand Down Expand Up @@ -137,18 +137,29 @@ const CellBuilder: FC<Props> = ({ info, projectId, type, form }) => {
</Select>
</Form.Item>
<Form.Item
{...restField}
name={[name, 'value']}
validateTrigger={['onChange', 'onBlur']}
rules={[
{
required: true,
message: 'Please input value',
},
]}
noStyle
shouldUpdate={(prev, next) => {
return true;
}}
>
<Input placeholder={getPlaceHolder(key)} />
{({ getFieldValue }) => {
return getFieldValue(['cell', index]) ? (
<Form.Item
{...restField}
name={[name, 'value']}
validateTrigger={['onChange', 'onBlur']}
rules={[
{
required: true,
message: 'Please input value',
},
]}
noStyle
>
<Input placeholder={getPlaceHolder(index)} />
</Form.Item>
) : null;
}}
</Form.Item>
<div className={s.cellActions}>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,17 @@ const ContractInteraction: FC<Props> = ({
</h3>
{language !== 'tact' && (
<>
<Form className={s.form} form={messageForm} onFinish={onSubmit}>
<Form
className={`${s.form} app-form`}
form={messageForm}
onFinish={onSubmit}
>
{cellBuilder('Update cell in ')}
<Button
type="default"
htmlType="submit"
loading={isLoading === 'setter'}
className={s.sendMessage}
className={`${s.sendMessage} bordered-gradient`}
>
Send
</Button>
Expand Down

0 comments on commit e404092

Please sign in to comment.