Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions react/src/components/AtomForm/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Field extends React.PureComponent {
const { atom, field, index, onChange, onValueChange, startSplittingAtom } = this.props
const { meta } = atom.record
const isCheck = meta.structure[field] && meta.structure[field].type === 'boolean'
const atomKey = atom.record.id || atom.record.lodashId

return (
<div
Expand All @@ -48,7 +49,7 @@ class Field extends React.PureComponent {
>
{isCheck && (
<AtomInput
key={field}
key={`${atomKey}-${field}`}
field={field}
atom={atom}
index={index}
Expand All @@ -62,7 +63,7 @@ class Field extends React.PureComponent {

{!isCheck && (
<AtomInput
key={field}
key={`${atomKey}-${field}`}
field={field}
atom={atom}
index={index}
Expand Down
4 changes: 3 additions & 1 deletion react/src/components/AtomForm/Fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import React from 'react'
import Field from './Field'

export default function Fields ({ atom, index, onChange, onValueChange, startSplittingAtom }) {
const atomKey = atom.record.id || atom.record.lodashId

return (
<React.Fragment>
{Object.keys(atom.record.meta.structure).map((field) => (
<Field
atom={atom}
field={field}
key={field}
key={`${atomKey}-${field}`}
index={index}
onChange={onChange}
onValueChange={onValueChange}
Expand Down
9 changes: 5 additions & 4 deletions react/src/components/AtomForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class AtomForm extends React.PureComponent {
{this.props.form.atoms.map((atom, index) => {
const asMolecule = molecule && !atom.record.meta.molecule_singleton
if (asMolecule) { nonSingletonIndex++ }
const atomKey = atom.record.id || atom.record.lodashId

const fillOutput = (input) => {
let zIndex = 100
Expand Down Expand Up @@ -306,7 +307,7 @@ class AtomForm extends React.PureComponent {
return (
<Associations
atom={atom}
key={input}
key={`${atomKey}-${input}`}
asyncData={asMolecule ? asyncData : undefined}
onChange={this.onAssociationChange}
onBlur={() => { this.setState({ focusedIndex: null }) }}
Expand All @@ -319,7 +320,7 @@ class AtomForm extends React.PureComponent {
} else if (input === 'STRUCTURE') {
return (
<Fields
key={input}
key={`${atomKey}-${input}`}
atom={atom}
onChange={this.onChange}
onValueChange={this.onValueChange}
Expand All @@ -331,7 +332,7 @@ class AtomForm extends React.PureComponent {
} else if (input === 'ATTACHMENTS') {
return (
<SingleAttachments
key={input}
key={`${atomKey}-${input}`}
attachments={atom.record.meta.attachments}
atom={atom.record}
index={index}
Expand All @@ -343,7 +344,7 @@ class AtomForm extends React.PureComponent {
} else if (input.indexOf('STRUCTURE/') !== -1) {
return (
<Field
key={input}
key={`${atomKey}-${input}`}
atom={atom}
field={input.replace('STRUCTURE/', '')}
onChange={this.onChange}
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/RichTextEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RichTextEditor extends React.PureComponent {
if (window.folioConsoleInitRedactor) {
window.folioConsoleInitRedactor(this.editorRef.current, {}, {
callbacks: {
changed: this.props.onChange
changed: (html) => this.props.onChange(html)
},
scrollTarget: this.props.scrollTarget
})
Expand Down