Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unable to load project with initial metadata #2043

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ export const getProjectByIdQuery = ({
});

if (projectById.data?.projectById?.metadata) {
projectById.data.projectById.metadata = await jsonLdCompact(
projectById.data.projectById.metadata,
);
projectById.data.projectById.metadata = await jsonLdCompact({
// NOTE: We set the context here to prevent a prefix confusion
// error when no context is provided and field values with the
// prefixes are present within the project metadata.
'@context': {
schema: 'http://schema.org/',
regen: 'https://schema.regen.network#',
qudt: 'http://qudt.org/schema/qudt/',
unit: 'http://qudt.org/vocab/unit/',
xsd: 'http://www.w3.org/2001/XMLSchema#',
},
...projectById.data.projectById.metadata,
});
}

return projectById;
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
return null;
}
},
Expand Down