- Issue created by @marcus.williams
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
I guess the alternative is creating dynamic unions for each reference field, which adds a heap of new non-reusable unions to the schema. It's possible, and it's how it started out working.
But I err'd on the side of less schema vs more types.
Basically you just end up with a heap of... {Node}{Page}{Fieldname}Union with the types allowed.It would now be a considerable shift in functionality, but what I can do is explore re-adding it and making it opt-in, as I totally understand the request.
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
Ok, heres your proof of concept.
https://git.drupalcode.org/issue/graphql_compose-3366088/-/commit/0be592...
If this is what you're thinking, we just have to figure out a nice way to integrate it without messing people around with a major schema change.
Thanks for the update, I'll try and have a look at it as soon as I can. If it's opt in surely that would mean it wouldn't affect anyone who uses it as it currently is unless I'm missing something.
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
Yeah leave it with me for the night, I'll grab a glass of wine and have a stab at it the UI side in a few hours.
- @almunnings opened merge request.
- Assigned to almunnings
- Status changed to Needs review
over 1 year ago 1:18pm 13 June 2023 - 🇦🇺Australia almunnings Melbourne, 🇦🇺
Ok, took a couple glasses. Got there.
Have a play with the MR if you can, see how that works for you.
Note: This is in line with 2-dev and will require a drush updatedb, so, uh, test accordingly.
This looks amazing, thanks for the quick response and looks like it's exactly what I was after. The only thing I'm unsure on is what it should do if there's only a single entity enabled i.e should it be
teaser { ... on ParagraphTeaser { id } }
or should it just return
teaser { id }
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
Yep I got ya.
It would mean your entity will return a new type on config change...
Single entity ref = single return type
Multiple entity ref = union return typeWhich could affect your frontend implementation - but you gotta risk it for the biscuit.
I'll push up a change now for you to play with.
- 🇦🇺Australia almunnings Melbourne, 🇦🇺
Cool stuff. I’ll wrote a test with some more wine and merge to dev for next release
-
almunnings →
committed 05f5c850 on 2.0.x
Resolve #3366088 "Entity reference fields"
-
almunnings →
committed 05f5c850 on 2.0.x
- Status changed to Fixed
over 1 year ago 11:25am 14 June 2023 - 🇦🇺Australia almunnings Melbourne, 🇦🇺
Ok, all done, in dev.
Thank you for shopping with us.
- Status changed to Fixed
over 1 year ago 7:31am 19 June 2023