Skip to content

Commit

Permalink
Stop passing the CreateItemModal component to field views
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed May 5, 2020
1 parent f826f95 commit 05cf4ab
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .changeset/three-coins-suffer.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
'@keystonejs/app-admin-ui': patch
'@keystonejs/app-admin-ui': minor
'@keystonejs/fields': minor
---

Cleaned up CreateItemModal implementation.
Cleaned up CreateItemModal implementation. The component is no longer passed to field views and should be imported from the @keystonejs/app-admin-ui package instead.
1 change: 0 additions & 1 deletion packages/app-admin-ui/client/components/CreateItemModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ const CreateItemModal = ({ prefillData = {}, onClose, onCreate }) => {
/* TODO: Permission query results */
errors={validationErrors[field.path] || []}
warnings={validationWarnings[field.path] || []}
CreateItemModal={CreateItemModal}
onChange={onChange}
renderContext="dialog"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { LoadingIndicator } from '@arch-ui/loading';
import Select from '@arch-ui/select';

import { validateFields, handleCreateUpdateMutationError } from '../util';
import CreateItemModal from './CreateItemModal';

const Render = ({ children }) => children();

Expand Down Expand Up @@ -177,7 +176,6 @@ const UpdateManyModal = ({ list, items, isOpen, onUpdate, onClose }) => {
warnings={validationWarnings[field.path] || []}
onChange={onChange}
renderContext="dialog"
CreateItemModal={CreateItemModal}
/>
),
[
Expand Down
1 change: 0 additions & 1 deletion packages/app-admin-ui/client/pages/Item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ const ItemDetails = ({
savedValue={initialData[field.path]}
onChange={onChange}
renderContext="page"
CreateItemModal={CreateItemModal}
/>
),
[
Expand Down
6 changes: 2 additions & 4 deletions packages/fields/src/types/Relationship/views/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IconButton } from '@arch-ui/button';
import Tooltip from '@arch-ui/tooltip';

import RelationshipSelect from './RelationshipSelect';
import { ListProvider, useList } from '@keystonejs/app-admin-ui/components';
import { CreateItemModal, ListProvider, useList } from '@keystonejs/app-admin-ui/components';

const MAX_IDS_IN_FILTER = 100;

Expand Down Expand Up @@ -103,7 +103,7 @@ function LinkToRelatedItems({ field, value }) {
);
}

function CreateAndAddItem({ field, item, onCreate, CreateItemModal }) {
function CreateAndAddItem({ field, item, onCreate }) {
const { list, openCreateItemModal } = useList();

let relatedList = field.adminMeta.getListByKey(field.config.ref);
Expand Down Expand Up @@ -167,7 +167,6 @@ const RelationshipField = ({
onChange,
item,
list,
CreateItemModal,
}) => {
const handleChange = option => {
const { many } = field.config;
Expand Down Expand Up @@ -209,7 +208,6 @@ const RelationshipField = ({
field={field}
item={item}
list={list}
CreateItemModal={CreateItemModal}
/>
</ListProvider>
{authStrategy && ref === authStrategy.listKey && (
Expand Down

0 comments on commit 05cf4ab

Please sign in to comment.