mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fix : on reload after disabling tranformation value gets cleared (#10476)
This commit is contained in:
parent
f9959610c8
commit
06d7d833db
1 changed files with 9 additions and 6 deletions
|
|
@ -110,10 +110,8 @@ export const Transformation = ({ changeOption, options, darkMode, queryId }) =>
|
|||
}, [lang]);
|
||||
|
||||
useEffect(() => {
|
||||
if (options.enableTransformation) {
|
||||
lang !== (options.transformationLanguage ?? 'javascript') && changeOption('transformationLanguage', lang);
|
||||
setState({ ...state, [lang]: options.transformation ?? defaultValue[lang] });
|
||||
}
|
||||
lang !== (options.transformationLanguage ?? 'javascript') && changeOption('transformationLanguage', lang);
|
||||
setState({ ...state, [lang]: options.transformation ?? state[lang] ?? defaultValue[lang] });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [JSON.stringify(options.transformation)]);
|
||||
|
||||
|
|
@ -141,6 +139,10 @@ export const Transformation = ({ changeOption, options, darkMode, queryId }) =>
|
|||
changeOption('enableTransformation', newEnableTransformation);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setEnableTransformation(options.enableTransformation);
|
||||
}, [options.enableTransformation]);
|
||||
|
||||
return (
|
||||
<div className="field transformation-editor">
|
||||
<div className="align-items-center gap-2 d-flex" style={{ position: 'relative', height: '20px' }}>
|
||||
|
|
@ -178,7 +180,6 @@ export const Transformation = ({ changeOption, options, darkMode, queryId }) =>
|
|||
</div>
|
||||
<br />
|
||||
<div className={`d-flex copilot-codehinter-wrap ${!enableTransformation && 'read-only-codehinter'}`}>
|
||||
{/* <div className="form-label"></div> */}
|
||||
<div className="col flex-grow-1">
|
||||
<div style={{ borderRadius: '6px', marginBottom: '20px', background: darkMode ? '#272822' : '#F8F9FA' }}>
|
||||
<div className="py-3 px-3 d-flex justify-content-between copilot-section-header">
|
||||
|
|
@ -228,7 +229,9 @@ export const Transformation = ({ changeOption, options, darkMode, queryId }) =>
|
|||
lineNumbers={true}
|
||||
height={400}
|
||||
className="query-hinter"
|
||||
onChange={(value) => changeOption('transformation', value)}
|
||||
onChange={(value) => {
|
||||
changeOption('transformation', value);
|
||||
}}
|
||||
componentName={`transformation`}
|
||||
cyLabel={'transformation-input'}
|
||||
callgpt={noop}
|
||||
|
|
|
|||
Loading…
Reference in a new issue