Skip to content

Commit

Permalink
feat(metadata-editor): remove templateId form metadataTemplateInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
wpiesiak committed Sep 18, 2024
1 parent 7f37667 commit 1a60ee8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/api/Metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ class Metadata extends File {
id: instance.$id,
fields,
scope: template.scope,
templateId: template.id,
templateKey: template.templateKey,
type: instance.$type,
};
Expand Down Expand Up @@ -830,7 +829,9 @@ class Metadata extends File {
const metadata = cache.get(key);
if (isMetadataRedesign) {
metadata.templateInstances.splice(
metadata.templateInstances.findIndex(instance => instance.templateId === template.id),
metadata.templateInstances.findIndex(
instance => instance.scope === scope && instance.templateKey === templateKey,
),
1,
);
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/api/__tests__/Metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ describe('api/Metadata', () => {
],
id: '123456',
templateKey: 'instance_from_template',
scope: 'enterprise',
},
true,
),
Expand All @@ -219,8 +220,7 @@ describe('api/Metadata', () => {
value: '2.1',
},
],
scope: undefined,
templateId: '123456',
scope: 'enterprise',
templateKey: 'instance_from_template',
});
});
Expand Down Expand Up @@ -254,7 +254,6 @@ describe('api/Metadata', () => {
value: 'This is string',
},
],
templateId: '123456',
templateKey: 'properties',
});
});
Expand Down
1 change: 0 additions & 1 deletion src/common/types/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ type MetadataTemplateInstance = {
id: string,
fields: MetadataTemplateInstanceField[],
scope: string,
templateId?: string,
templateKey: string,
type: string,
};
Expand Down

0 comments on commit 1a60ee8

Please sign in to comment.