Before this PR, only node connection was handled (through reference using ReferenceInput).
Now, we can also update existing nodes (nodes already connected), without using ReferenceInput.
import React from 'react';
import { Edit, SimpleForm, TextField, TextInput } from 'react-admin';
import CustomerEditToolbar from './CustomerEditToolbar';
import ColorInput from './inputs/ColorInput';
const CustomerEdit = (props): JSX.Element => {
// Not SSR compatible
const RichTextInput = require('ra-input-rich-text');
console.log('customerEdit props', props);
return (
<Edit {...props}>
<SimpleForm
toolbar={<CustomerEditToolbar />}
redirect={false}
>
<TextField source="ref" label={'Reference (#)'} />
<TextInput source="labelEN" label={'Label (EN)'} />
<TextInput source="labelFR" label={'Label (FR)'} />
<ColorInput source="theme.primaryColor" label={'Color'} /> // <= This is a node update, it updates a customer.theme.primaryColor field when saving the customer
</SimpleForm>
</Edit>
);
};
export default CustomerEdit;
Allow nodes updates
Before this PR, only node connection was handled (through reference using
ReferenceInput
). Now, we can also update existing nodes (nodes already connected), without usingReferenceInput
.Fixes https://github.com/marcantoine/ra-data-graphql-prisma/issues/20#issuecomment-599075695