Skip to content

Commit

Permalink
chore: cleanup onChange usages
Browse files Browse the repository at this point in the history
Related to #1147
  • Loading branch information
Skaiir committed Apr 17, 2024
1 parent fbff495 commit a35df2b
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 15 deletions.
1 change: 0 additions & 1 deletion packages/form-js-playground/test/custom/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function RangeRenderer(props) {

const onChange = ({ target }) => {
props.onChange({
field,
value: Number(target.value),
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ export class RepeatRenderManager {
shouldScroll.current = true;

props.onChange({
field: repeaterField,
value: updatedValues,
indexes,
});

setSharedRepeatState((state) => ({ ...state, isCollapsed: false }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function Checkbox(props) {

const onChange = ({ target }) => {
props.onChange({
field,
value: target.checked,
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function Checklist(props) {
: [...values, toggledValue];

props.onChange({
field,
value: newValues,
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export function Radio(props) {

const onChange = (v) => {
props.onChange({
field,
value: v,
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export function Taglist(props) {
return;
}

props.onChange({ value: [...values, value], field });
props.onChange({ value: [...values, value] });
};

const deselectValue = (value) => {
const newValues = values.filter((v) => !isEqual(v, value));
props.onChange({ value: newValues, field });
props.onChange({ value: newValues });
};

const onInputChange = ({ target }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function Textarea(props) {

const [onChange, flushOnChange] = useFlushDebounce(({ target }) => {
props.onChange({
field,
value: target.value,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function Textfield(props) {

const [onInputChange, flushOnChange] = useFlushDebounce(({ target }) => {
props.onChange({
field,
value: target.value,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export function SearchableSelect(props) {
const setValue = useCallback(
(option) => {
setFilter((option && option.label) || '');
props.onChange({ value: (option && option.value) || null, field });
props.onChange({ value: (option && option.value) || null });
},
[field, props],
[props],
);

const displayState = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export function SimpleSelect(props) {

const setValue = useCallback(
(option) => {
props.onChange({ value: (option && option.value) || null, field });
props.onChange({ value: (option && option.value) || null });
},
[field, props],
[props],
);

const displayState = useMemo(() => {
Expand Down
1 change: 0 additions & 1 deletion packages/form-js-viewer/test/spec/custom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function Range(props) {

const onChange = ({ target }) => {
props.onChange({
field,
value: Number(target.value),
});
};
Expand Down

0 comments on commit a35df2b

Please sign in to comment.