Skip to content

Commit

Permalink
before deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
lackdaz committed Jun 1, 2017
1 parent 9743eb3 commit dd45a54
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
23 changes: 7 additions & 16 deletions client/app/bundles/Main/components/ChatBotComponents/Intent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class WitAi extends Component {
result: '',
show: '',
trigger: false,
clear: false
steps: {}
}

this.triggetNext = this.triggetNext.bind(this)
Expand Down Expand Up @@ -60,7 +60,7 @@ export default class WitAi extends Component {
self.triggetNext(self.state.result)
}
}).catch(console.error)
self.setState({ clear: false})

}

triggetNext (triggerInput, value) {
Expand All @@ -76,30 +76,21 @@ export default class WitAi extends Component {

if (this.props.tonesArr !== nextProps.tonesArr) {
this.setState({
clear: true
tonesArr: nextProps.tonesArr,
steps: nextProps.steps
})
}
}

shouldComponentUpdate (nextProps, nextState) {
if (this.props.tonesArr !== nextProps.tonesArr && nextState.clear) {
// if (this.props.tonesArr !== nextProps.tonesArr || this.steps !== nextProps.steps) {
if (this.props.tonesArr !== nextProps.tonesArr) {

return true
}
return false
}

componentDidUpdate (prevProps, prevState) {
const { loading, clear, result, trigger } = this.state
if (!loading) {
this.setState({
clear: false,
loading: false,
trigger: false,
result: '',
})
}
}

componentWillUpdate () {
this.witCall()
}
Expand Down
16 changes: 14 additions & 2 deletions client/app/bundles/Main/components/MainApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ export default class MainApp extends React.Component {
steps: steps,
opened: false,
floating: true,
inputValue: '',
inputValue: undefined,
sentiment: '',
endDelay: 2000,
tonesArr: []
tonesArr: [],
}

// Callback function to trigger next step when user attribute is true. Optionally you can pass a object with value to be setted in the step and the next step to be triggered
Expand Down Expand Up @@ -320,6 +320,18 @@ export default class MainApp extends React.Component {
// }, this.state.endDelay)
}

componentWillUpdate(nextProps, nextState) {
// console.log("called receive props!")
// console.log(this.props.opened)
// console.log(nextProps.opened)
// console.log(this.props.opened !== nextProps.opened)
if (this.state.inputValue === nextState.inputValue) {
this.setState({
inputValue: undefined
})
}
}

componentDidUpdate (prevProps, prevState) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ class ChatBot extends Component {
})
}

componentDidMount () {
componentDidMount (prevProps, prevState) {
const chatbotContent = document.querySelector('.rsc-content')



/* istanbul ignore next */
if (chatbotContent) {
chatbotContent.addEventListener('DOMNodeInserted', this.onNodeInserted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default class SentimentBot extends React.Component {
// console.log(this.props.opened)
// console.log(nextProps.opened)
// console.log(this.props.opened !== nextProps.opened)
if (this.props.response !== nextProps.response) {
if (this.props.response !== nextProps.response && this.props.toneArr === nextProps.toneArr) {
this.checktone(nextProps.response)
}
}
Expand Down

0 comments on commit dd45a54

Please sign in to comment.