-
Notifications
You must be signed in to change notification settings - Fork 91
feat(renderer): enable condition set as a function #1331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
A new version (feat) will be released: v3.19.0 [DataDrivenFormsBot] |
Codecov Report
@@ Coverage Diff @@
## master #1331 +/- ##
==========================================
+ Coverage 95.09% 95.11% +0.01%
==========================================
Files 209 209
Lines 3627 3641 +14
Branches 1265 1270 +5
==========================================
+ Hits 3449 3463 +14
Misses 178 178
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
1f993da
to
6d7bac3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, it looks great!
Checked only the code so far, found some nitpicks.
Could you please also update the documentation to introduce this new feature?
import PropTypes from 'prop-types'; | ||
import isEqual from 'lodash/isEqual'; | ||
|
||
import useFormApi from '../use-form-api'; | ||
import parseCondition from '../parse-condition'; | ||
|
||
function setterValueCheck(setterValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use arrow function notation here to keep the consistency?
@@ -42,6 +52,14 @@ const Condition = React.memo( | |||
} | |||
}, [dirty]); | |||
|
|||
const x = useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x
is kinda a mysterious name 😵💫
formOptions.change(name, value); | ||
}); | ||
}, | ||
[formOptions.change] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formOptions.change will be always the same, so no need to check it
@@ -531,6 +531,150 @@ describe('condition test', () => { | |||
await waitFor(() => expect(screen.getByLabelText('field2')).toHaveValue('set with then')); | |||
}); | |||
|
|||
test('should change fileds value by set funciton', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use it
instead of test
, also a typo here
6d7bac3
to
843db93
Compare
843db93
to
955459a
Compare
Object.entries(setter).forEach(([name, value]) => { | ||
formOptions.change(name, value); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to keep an empty dependency array here: []
otherwise the function will be always re-created.
See here
955459a
to
14de368
Compare
🎉 This PR is included in version 3.19.0 🎉 The release is available on |
Fixes #1326
Checklist: (please see documentation page for more information)
Yarn build
passesYarn lint
passesYarn test
passesfix|feat({scope}): {description}
fix(pf3): wizard correctly handles next button
Fix button on documenation example page