Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
fix(persistence of notes): user doesn't have to click away to get not…
Browse files Browse the repository at this point in the history
…e to work
  • Loading branch information
hopetambala committed Jul 17, 2019
1 parent 75df891 commit 209d2b7
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/features/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class TooltipControls extends React.Component {
constructor(props){
super(props)
this.state = this.initialState;
/*this.state = {
...this.state,
showNote:false
}*/
}

get initialState(){
Expand All @@ -23,7 +27,6 @@ class TooltipControls extends React.Component {
width:"300px",
position: [200,200],
currentLabel:"",
showNote: false,
note: {
id:'',
note:{
Expand Down Expand Up @@ -68,7 +71,7 @@ class TooltipControls extends React.Component {
await this.setState({note});

await this.props.addNote(this.state.note);
this.resetBuilder()
//this.resetBuilder()
} catch(error){
alert('No search key')
}
Expand All @@ -95,20 +98,16 @@ class TooltipControls extends React.Component {
}

componentDidUpdate = (prevProps) => {
if (prevProps.data !== this.props.data) {
if(this.props.data.fieldValue){
}
if (prevProps.data !== this.props.data) {
var note = {...this.state.note}
note.id = this.props.data.CRVIZ._SEARCH_KEY
if (note.id in this.props.notes){
this.setState({
note: this.props.notes[note.id]
});
}
else{
var note = {...this.state.note}
note.id = this.props.data.CRVIZ._SEARCH_KEY
if (note.id in this.props.notes){
this.setState({
note: this.props.notes[note.id]
});
}
else{
this.resetBuilder()
}
this.resetBuilder()
}
}
}
Expand Down

0 comments on commit 209d2b7

Please sign in to comment.