mirror of https://github.com/portainer/portainer
fix(edge-stack): revert useEffect, to call matchRegistry less often [BE-11501] (#239)
parent
94fda6a720
commit
117e3500ae
|
@ -1,5 +1,4 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect } from 'react';
|
|
||||||
|
|
||||||
import { notifyError } from '@/portainer/services/notifications';
|
import { notifyError } from '@/portainer/services/notifications';
|
||||||
import { PrivateRegistryFieldset } from '@/react/edge/edge-stacks/components/PrivateRegistryFieldset';
|
import { PrivateRegistryFieldset } from '@/react/edge/edge-stacks/components/PrivateRegistryFieldset';
|
||||||
|
@ -32,11 +31,6 @@ export function PrivateRegistryFieldsetWrapper({
|
||||||
|
|
||||||
const registriesQuery = useRegistries({ hideDefault: true });
|
const registriesQuery = useRegistries({ hideDefault: true });
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
matchRegistry(values);
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [values.file, values.fileContent]);
|
|
||||||
|
|
||||||
if (!registriesQuery.data) {
|
if (!registriesQuery.data) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
|
||||||
import { withGlobalError } from '@/react-tools/react-query';
|
|
||||||
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
import { RegistryId } from '@/react/portainer/registries/types/registry';
|
||||||
import axios, {
|
import axios, {
|
||||||
json2formData,
|
json2formData,
|
||||||
|
@ -10,9 +9,10 @@ import axios, {
|
||||||
import { buildUrl } from './buildUrl';
|
import { buildUrl } from './buildUrl';
|
||||||
|
|
||||||
export function useParseRegistries() {
|
export function useParseRegistries() {
|
||||||
return useMutation(parseRegistries, {
|
return useMutation(
|
||||||
...withGlobalError('Failed parsing registries'),
|
parseRegistries
|
||||||
});
|
// handle errors in the calling function (notifyError vs setting form errors in validation)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function parseRegistries({
|
export async function parseRegistries({
|
||||||
|
|
Loading…
Reference in New Issue