From 1a9cb7bc43d218fe7e6b264a0ff889501299c7de Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Thu, 7 Mar 2019 00:22:32 -0500 Subject: [PATCH] fix(react): multiple renders --- src/client/containers/Modals/CreateTicketModal.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/containers/Modals/CreateTicketModal.jsx b/src/client/containers/Modals/CreateTicketModal.jsx index 6ac91accd..289d4c500 100644 --- a/src/client/containers/Modals/CreateTicketModal.jsx +++ b/src/client/containers/Modals/CreateTicketModal.jsx @@ -96,12 +96,12 @@ class CreateTicketModal extends React.Component { const $form = $(e.target) let data = {} - if (this.state.issueText.length < 1) return + if (this.issueText.length < 1) return const minIssueLength = this.props.viewdata.ticketSettings.minIssue let $mdeError const $issueTextbox = $(this.issueMde.element) const $errorBorderWrap = $issueTextbox.parents('.error-border-wrap') - if (this.state.issueText.length < minIssueLength) { + if (this.issueText.length < minIssueLength) { $errorBorderWrap.css({ border: '1px solid #E74C3C' }) const mdeError = $( `
Please enter a valid issue. Issue must contain at least ${minIssueLength} characters
` @@ -130,6 +130,7 @@ class CreateTicketModal extends React.Component { } render () { + console.log('RENDER') const { viewdata } = this.props const mappedGroups = this.props.viewdata.groups.map(grp => { return { text: grp.name, value: grp._id } @@ -239,7 +240,7 @@ class CreateTicketModal extends React.Component {
(this.issueMde = i)} - onChange={e => this.setState({ issueText: e })} + onChange={val => (this.issueText = val)} allowImageUpload={true} inlineImageUploadUrl={'/tickets/uploadmdeimage'} inlineImageUploadHeaders={{ ticketid: 'uploads' }}