Skip to content

Commit

Permalink
feat(metadata-sidebar): remove empty update function
Browse files Browse the repository at this point in the history
  • Loading branch information
karolinaru committed Sep 24, 2024
1 parent bf84a54 commit e2a1f23
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
6 changes: 2 additions & 4 deletions src/elements/content-sidebar/MetadataSidebarRedesign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function MetadataSidebarRedesign({
errorMessage,
status,
templateInstances,
updateMetadataInstance,
} = useSidebarMetadataFetcher(api, fileId, onError, isFeatureEnabled);

const { formatMessage } = useIntl();
Expand Down Expand Up @@ -115,9 +114,8 @@ function MetadataSidebarRedesign({
};

const handleSubmit = async (values: FormValues) => {
isExistingMetadataInstance()
? updateMetadataInstance()
: handleCreateMetadataInstance(values.metadata as MetadataTemplateInstance, () => setEditingTemplate(null));
!isExistingMetadataInstance() &&
handleCreateMetadataInstance(values.metadata as MetadataTemplateInstance, () => setEditingTemplate(null));
};

const metadataDropdown = status === STATUS.SUCCESS && templates && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ describe('elements/content-sidebar/Metadata/MetadataSidebarRedesign', () => {
errorMessage: null,
status: STATUS.SUCCESS,
file: mockFile,
updateMetadataInstance: jest.fn(),
});
});

Expand Down Expand Up @@ -124,7 +123,6 @@ describe('elements/content-sidebar/Metadata/MetadataSidebarRedesign', () => {
},
status: STATUS.ERROR,
file: mockFile,
updateMetadataInstance: jest.fn(),
});

const errorMessage = { id: 'error', defaultMessage: 'error message' };
Expand All @@ -143,7 +141,6 @@ describe('elements/content-sidebar/Metadata/MetadataSidebarRedesign', () => {
errorMessage: null,
status: STATUS.LOADING,
file: mockFile,
updateMetadataInstance: jest.fn(),
});

renderComponent();
Expand Down Expand Up @@ -180,7 +177,6 @@ describe('elements/content-sidebar/Metadata/MetadataSidebarRedesign', () => {
status: STATUS.SUCCESS,
file: mockFile,
handleCreateMetadataInstance: jest.fn(),
updateMetadataInstance: jest.fn(),
});

renderComponent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interface DataFetcher {
status: STATUS;
templateInstances: Array<MetadataTemplateInstance>;
templates: Array<MetadataTemplate>;
updateMetadataInstance: () => void;
}

function useSidebarMetadataFetcher(
Expand Down Expand Up @@ -147,10 +146,6 @@ function useSidebarMetadataFetcher(
[api, onApiError, file, deleteMetadataInstanceSuccessCallback],
);

const updateMetadataInstance = () => {
// to be implemented in the next ticket
};

const handleCreateMetadataInstance = React.useCallback(
(templateInstance: MetadataTemplateInstance, successCallback): void => {
api.getMetadataAPI(false).createMetadataRedesign(
Expand Down Expand Up @@ -182,7 +177,6 @@ function useSidebarMetadataFetcher(
status,
templateInstances,
templates,
updateMetadataInstance,
};
}

Expand Down

0 comments on commit e2a1f23

Please sign in to comment.