Forcefully add special subproperties to the selection of RichText, file, and role fields#852
Conversation
airhorns
left a comment
There was a problem hiding this comment.
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.
| addRequiredFieldsToSelection(field.apiIdentifier, field); | ||
| } | ||
|
|
||
| return select; |
There was a problem hiding this comment.
i think this is complicated enough to deserve a test -- if you're outskie today LMK and I can whip one up!
There was a problem hiding this comment.
I'll be around until about 4pm. I'll try to get one up before then
There was a problem hiding this comment.
Unfortunately I gotta run now. If you could add some quick tests, that would be spectacular 🫡
13ee708 to
737b1d7
Compare
…le, and role fields
737b1d7 to
7e17098
Compare
airhorns
left a comment
There was a problem hiding this comment.
i think this is a great idea but api-client-core has been replaced with @gadgetinc/core and @gadgetinc/connection in the monorepo, gotta make these changes over there
| * When a user passes `{ field: true }` for a field that requires sub-selections | ||
| * (like richText, file, or role fields), auto-expand it using the defaultSelection. | ||
| */ | ||
| const normalizeSelection = (selection: FieldSelection, defaultSelection: FieldSelection): FieldSelection => { |
There was a problem hiding this comment.
sadly api-client-core is no more -- this change has to go in the generated code inside the monorepo now
There was a problem hiding this comment.
sadly?
- gladly * api-client-core is no more. I'm closing this to rely on API side only change for this
There was a problem hiding this comment.
oops - fat fingered a merge but reverted immediately here #964
selectoverride could have some friction if you selected richText, role, or file fields.{richTextField: true, fileField:true, roleField:true}would lead to errors{richText:{markdown: true, truncatedHTML: true}, }{fileField: {url: true, mimeType: true, fileName: true,}}{roleField: {key: true, name: true,}}