Skip to content
Snippets Groups Projects

hotfix fo DEV_JAN_24 replease

Merged Lijun Xing requested to merge dev into master
1 file
+ 1
28
Compare changes
  • Side-by-side
  • Inline
@@ -193,45 +193,19 @@ class UploadFileListItem extends React.Component {
type: this.props.file.type ? this.props.file.type : '',
loading: false,
tooLong: false,
isCopy: false,
}
componentDidMount() {
this._mounted = true
this.setState({ label: this.props.file.label || '' })
}
componentWillUnmount() {
this._mounted = false
}
checkLabel = e => {
if (this._mounted) {
const {
files: allFiles,
file: { id, type },
} = this.props
const { files } = allFiles.find(t => t.value === type)
const { value } = e.target
const { length } = value
e.target.setSelectionRange(length, length)
if (length > 100) {
this.setState({ tooLong: true })
} else if (files.some(f => f.id !== id && f.label === value)) {
this.setState({ isCopy: true })
} else {
this.setState({ tooLong: false, isCopy: false })
this.props.setLabel(value)
}
}
}
static contextType = UserContext
render() {
const currentUser = this.context
const { label, type, loading, tooLong, isCopy } = this.state
const { label, type, loading, tooLong } = this.state
const { types, file, manuscript, pdfSend, setNotification } = this.props
const invalid = !file.label || tooLong || isCopy
const invalidProps = { invalidTest: invalid }
if (invalid) invalidProps['data-error'] = true
return (
<Mutation
awaitRefetchQueries
@@ -365,7 +339,6 @@ class UploadFileListItem extends React.Component {
const obj = {}
obj[key] = val
if (this._mounted) {
this.checkLabel()
if (key === 'label' && val.length > 100) {
this.setState({ tooLong: true })
} else {