Skip to content

Commit

Permalink
chore: create new schemaCache for every version
Browse files Browse the repository at this point in the history
  • Loading branch information
erdkse committed Feb 21, 2022
1 parent cff2020 commit 6f7ecbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/organisms/SettingsManager/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export const Settings = ({
onChange={handleK8SVersionChange}
style={{width: doesSchemaExist(selectedK8SVersion) ? '100%' : 'calc(100% - 172px)'}}
optionLabelProp="label"
showSearch
>
{k8sVersions.map(version => (
<Select.Option key={version} value={version} label={version}>
Expand Down
3 changes: 2 additions & 1 deletion src/redux/services/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const HELM_CHART_SCHEMA = JSON.parse(loadResource('form-schemas/helm-chart-schem
// @ts-ignore
const HELM_CHART_UI_SCHEMA = JSON.parse(loadResource('form-schemas/helm-chart-ui-schema.json'));

const k8sSchemaCache = new Map<string, any | undefined>();
let k8sSchemaCache = new Map<string, any | undefined>();
/**
* Returns a JSON Schema for the specified resource kind
*/
Expand All @@ -44,6 +44,7 @@ export function getResourceSchema(resource: K8sResource, schemaVersion: string,
k8sSchema = JSON.parse(
readFileSync(path.join(String(userDataDir), path.sep, 'schemas', `${schemaVersion}.json`), 'utf-8')
);
k8sSchemaCache = new Map<string, any | undefined>();
k8sSchemaCache.set(schemaVersion, k8sSchema);
}

Expand Down

0 comments on commit 6f7ecbe

Please sign in to comment.