Skip to content

Forcefully add special subproperties to the selection of RichText, file, and role fields #852

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: main
Choose a base branch
from

Conversation

MillanWangGadget
Copy link
Contributor

  • UPDATE
    • Previously, passing in a select override could have some friction if you selected richText, role, or file fields.
      • {richTextField: true, fileField:true, roleField:true} would lead to errors
      • Selections like this were needed instead to make things work
        • {richText:{markdown: true, truncatedHTML: true}, }
        • {fileField: {url: true, mimeType: true, fileName: true,}}
        • {roleField: {key: true, name: true,}}
    • Those object based selections are not intuitive. Now, a simple true bool for the whole field will be autoTranslated into the object based selection so you don't gotta look up the inner details of the field in order to select it

Copy link
Contributor

@airhorns airhorns left a comment

Choose a reason for hiding this comment

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

This makes sense to me and is a big improvement but I wish we had it for non-AutoForm use cases as well like a plain old api.widget.findMany({select: { gizmos: true }});. It bugs me a little that the two will be inconsistent, but since this is a step in the right direction we should go for it and then move it down a layer when we can.

}
};

for (const field of rootFieldsMetadata) {
addIdToSelection(field.apiIdentifier, field);
addRequiredFieldsToSelection(field.apiIdentifier, field);
}

return select;
Copy link
Contributor

Choose a reason for hiding this comment

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

i think this is complicated enough to deserve a test -- if you're outskie today LMK and I can whip one up!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll be around until about 4pm. I'll try to get one up before then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately I gotta run now. If you could add some quick tests, that would be spectacular 🫡

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