Skip to content

Commit

Permalink
Do not fetch all secrets if there is no secret name
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-jerolimov committed May 11, 2022
1 parent 80372ef commit d859458
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ const SourceSecretSelector: React.FC<{
const { values, setFieldValue } = useFormikContext<FormikValues>();
const namespace: string = _.get(values, `${fieldPrefix}project.name`);
const secret: string = _.get(values, `${fieldPrefix}git.secret`);
const [data, loaded, loadError] = useK8sWatchResource({
kind: SecretModel.kind,
namespace,
name: secret,
optional: true,
isList: false,
});
const [data, loaded, loadError] = useK8sWatchResource(
namespace && secret
? {
kind: SecretModel.kind,
namespace,
name: secret,
optional: true,
isList: false,
}
: null,
);

const handleSave = (name: string) => {
setFieldValue(`${fieldPrefix}git.secret`, name);
Expand Down

0 comments on commit d859458

Please sign in to comment.