Skip to content

Commit

Permalink
Merge pull request #11476 from jerolimov/tojson-cache-improvements-4.9
Browse files Browse the repository at this point in the history
[release-4.9] Bug 2084028: Improve Firehose cache, so that it does not return unexpected data also if isList differs on two concurrent calls
  • Loading branch information
openshift-merge-robot authored May 17, 2022
2 parents 437ecea + d859458 commit bd45974
Show file tree
Hide file tree
Showing 10 changed files with 812 additions and 66 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
4 changes: 2 additions & 2 deletions frontend/public/components/utils/__tests__/firehose.data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const podData = {
kind: 'Pod',
metadata: {
name: 'my-pod',
namespace: 'default',
namespace: 'my-namespace',
resourceVersion: '123',
},
};
Expand All @@ -20,7 +20,7 @@ export const podList = {
kind: 'Pod',
metadata: {
name,
namespace: 'default',
namespace: 'my-namespace',
resourceVersion: '123',
},
})),
Expand Down
Loading

0 comments on commit bd45974

Please sign in to comment.