Skip to content

[ENG-8159] Allow collections without metadata to be submitted. #2567

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

Open
wants to merge 1 commit into
base: feature/pbs-25-10
Choose a base branch
from

Conversation

bp-cos
Copy link
Contributor

@bp-cos bp-cos commented Jun 3, 2025

Purpose

Collections without meta-data were throwing errors because the attributes object was null.

Summary of Changes

If the attributes object is null then it is instantiated with an empty object

Screenshot(s)

N.A

Side Effects

Lots regarding the user experience which I have documented for Mark.

QA Notes

You will need to turn off all metadata in the admin before testing

image

@bp-cos bp-cos requested a review from futa-ikeda June 3, 2025 20:36
Copy link
Contributor

@futa-ikeda futa-ikeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a fun one to debug 😬

Comment on lines +14 to +15
const { data, data: { relationships } } = serialized;
data.attributes = data.attributes || { };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, in the case where the provider has no collection-specific metadata (no issue, volume, studyDesign, etc), the collection-submissionhas no attributes, only relationships. So in this case,data.attributesisundefined`, so we need to instantiate it as an empty object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants