Skip to content

Commit

Permalink
Merge pull request #1474 from thehyve/multi-model-views
Browse files Browse the repository at this point in the history
Fix linter warnings on exhaustive-deps.
  • Loading branch information
ewelinagr authored Jan 25, 2024
2 parents 6797bc1 + c0f1f1d commit 4255407
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions projects/mercury/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const APPLICATION_NAME = 'Fairspace';
export const METADATA_VIEW_MENU_LABEL = 'Metadata';
export const LOCAL_STORAGE_MENU_KEY = 'FAIRSPACE_MENU_EXPANDED';
export const CUT = 'CUT';
export const COPY = 'COPY';
Expand Down
9 changes: 7 additions & 2 deletions projects/mercury/src/metadata/LinkedDataMetadataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ const LinkedDataMetadataProvider = ({children, ...otherProps}) => {
const fetchMetadataBySubject = useCallback((subject) => metadataAPI.getDict({subject, withValueProperties: true})
.catch(() => {
throw new Error('An error occurred while loading the metadata');
// eslint-disable-next-line react-hooks/exhaustive-deps
}), []);

const submitLinkedDataChanges = useCallback((subject, values) => metadataAPI.get({subject})
.then(meta => (meta.length && getFirstPredicateValue(meta[0], '@type')))
.then(type => metadataAPI.updateEntity(subject, values, vocabulary, type)), [vocabulary]);
.then(type => metadataAPI.updateEntity(subject, values, vocabulary, type)),
// eslint-disable-next-line react-hooks/exhaustive-deps
[vocabulary]);

const createLinkedDataEntity = useCallback((subject, values, type) => metadataAPI.get({subject})
.then((meta) => {
Expand All @@ -31,7 +34,9 @@ const LinkedDataMetadataProvider = ({children, ...otherProps}) => {
}
})
.then(() => metadataAPI.updateEntity(subject, values, vocabulary, type))
.then(() => ({subject, type, values})), [vocabulary]);
.then(() => ({subject, type, values})),
// eslint-disable-next-line react-hooks/exhaustive-deps
[vocabulary]);

const deleteLinkedDataEntity = (subject) => metadataAPI.delete(subject);

Expand Down
3 changes: 2 additions & 1 deletion projects/mercury/src/routes/WorkspaceRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import MetadataView from '../metadata/views/MetadataView';
import BreadcrumbsContext from '../common/contexts/BreadcrumbsContext';
import {ExternalStoragePage} from "../external-storage/ExternalStoragePage";
import ExternalMetadataSourcesView from "../metadata/external-sources/ExternalMetadataSourceView";
import {METADATA_VIEW_MENU_LABEL} from "../constants";

const getSubject = () => (
document.location.search ? queryString.parse(document.location.search).iri : null
Expand Down Expand Up @@ -105,7 +106,7 @@ const WorkspaceRoutes = () => {
if (subject) {
return (
<MetadataWrapper>
<LinkedDataEntityPage title="Metadata" subject={subject} />
<LinkedDataEntityPage title={METADATA_VIEW_MENU_LABEL} subject={subject} />
</MetadataWrapper>
);
}
Expand Down

0 comments on commit 4255407

Please sign in to comment.