Skip to content

Commit

Permalink
Fixed issue when changing filter types
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Feb 14, 2023
1 parent 0cf0e3e commit 940d3cf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ui/src/app/metadata/hoc/MetadataSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function MetadataSchema({ type, children, wizard = false }) {

const [schema, setSchema] = React.useState();

async function loadSchema(type) {
const loadSchema = React.useCallback(async (type) => {
const definition = wizard ? getWizard(type) : getDefinition(type);
setDefinition(definition);
setKind(type);
Expand All @@ -34,11 +34,12 @@ export function MetadataSchema({ type, children, wizard = false }) {
setSchema(source);
}
setLoading(false);
}
}, [response.ok, get, wizard]);

React.useState(() => {
React.useEffect(() => {
loadSchema(type);
}, [type]);
setSchema(null);
}, [type, loadSchema]);

return (
<MetadataDefinitionContext.Provider value={definition}>
Expand Down

0 comments on commit 940d3cf

Please sign in to comment.