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

Cleaned up CreateItemModal implementation #2873

Merged

Conversation

Vultraz
Copy link
Contributor

@Vultraz Vultraz commented May 2, 2020

CreateItemModal is no longer passed through to field views via prop. It can be imported from the admin UI package.

@changeset-bot
Copy link

changeset-bot bot commented May 2, 2020

🦋 Changeset is good to go

Latest commit: 71267f3

We got this.

This PR includes changesets to release 2 packages
Name Type
@keystonejs/app-admin-ui Minor
@keystonejs/fields Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gautamsi
Copy link
Member

gautamsi commented May 2, 2020

can you also factor that out into separate package? like admin-ui-components @MadeByMike and I debated multiple times about the name of package but there is no conclusion.

@Vultraz
Copy link
Contributor Author

Vultraz commented May 2, 2020

I don't think that's a good idea. These are Admin UI components. We can't keep splitting everything into smaller and smaller packages, and each new package has a cost in terms of maintainability. 🤔

@gautamsi
Copy link
Member

gautamsi commented May 2, 2020

I had it first passed as prop to eliminate two different implementation for CreateItemModal. One in admin-ui and another in Relationship field.

Having each field which needs CreateItemModal and other component, dependent on app-admin-ui package is also not a good thing IMO

@Vultraz
Copy link
Contributor Author

Vultraz commented May 2, 2020

Two different implementations? I don't understand. There's no custom implementation in the Relationship field.

I agree it's not great to have the fields package depend on the admin ui, but the Relationship field already imports some stuff from the admin ui package (useList, for example), and using a prop model isn't great design. If more components were needed, for example, should each of them get a prop too? That feels even worse.

I think the problem here (and it's definitely beyond the scope of this issue), is the fact that we're trying to keep everything walled off when there is need for cross-dependence. The field views are meant for the admin ui, so it makes sense for them to be able to import admin UI things. But in that case, separation of concerns dictates that either they be in the same package (not possible under the current design), they depend on one another (seems people don't want this), or we create a third package... which just makes things harder to maintain and leads to more dependency version issues like have already been seen. :/

@gautamsi
Copy link
Member

gautamsi commented May 3, 2020

Two different implementations? I don't understand. There's no custom implementation in the Relationship field.

there was, see #1880

@Vultraz
Copy link
Contributor Author

Vultraz commented May 3, 2020

Oh, I hadn't seen that one.

@MadeByMike
Copy link
Contributor

@Vultraz I like this. I know there was a bit of prop-drilling with passing the createItem mutation to the modal, but the create action was deliberately removed from the modal component to allow the possibility of generating a create item modal with a custom form handler.

Maybe this is ok and what we actually want to split out is just the form rendering bit inside Drawer as well as a more generic modal? What are your thoughts?

@Vultraz
Copy link
Contributor Author

Vultraz commented May 4, 2020

Agree on splitting out a more generic modal.

@Vultraz Vultraz force-pushed the admin-ui-cleaned-up-create-modal branch from 0035406 to 05cf4ab Compare May 5, 2020 06:00
@Vultraz
Copy link
Contributor Author

Vultraz commented May 5, 2020

Conflict be gone.

Copy link
Contributor

@MadeByMike MadeByMike left a comment

Choose a reason for hiding this comment

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

Approving this... but would like another pass in future at a generic modal and form generation

@timleslie timleslie merged commit bcf03a7 into keystonejs:master May 7, 2020
@Vultraz Vultraz deleted the admin-ui-cleaned-up-create-modal branch May 7, 2020 05:34
This was referenced May 7, 2020
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.

None yet

4 participants