Skip to content
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

Bug 1836113: fixes issue with error being shown across sources #5456

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -14,12 +14,13 @@ interface EventSourcesSelectorProps {

const EventSourcesSelector: React.FC<EventSourcesSelectorProps> = ({ eventSourceList }) => {
const eventSourceItems = Object.keys(eventSourceList).length;
const { setFieldValue, setFieldTouched, validateForm, setErrors } = useFormikContext<
const { setFieldValue, setFieldTouched, validateForm, setErrors, setStatus } = useFormikContext<
FormikValues
>();
const handleItemChange = React.useCallback(
(item: string) => {
setErrors({});
setStatus({});
if (isKnownEventSource(item)) {
const nameData = `data.${item.toLowerCase()}`;
const sourceData = getEventSourceData(item.toLowerCase());
Expand All @@ -36,7 +37,7 @@ const EventSourcesSelector: React.FC<EventSourcesSelectorProps> = ({ eventSource
setFieldTouched('apiVersion', true);
validateForm();
},
[setErrors, setFieldValue, setFieldTouched, validateForm],
[setErrors, setStatus, setFieldValue, setFieldTouched, validateForm],
);

const itemSelectorField = (
Expand Down
Expand Up @@ -13,6 +13,7 @@ jest.mock('formik', () => ({
useFormikContext: jest.fn(() => ({
setFieldValue: jest.fn(),
setFieldTouched: jest.fn(),
setStatus: jest.fn(),
validateForm: jest.fn(),
setErrors: jest.fn(),
values: {
Expand Down