Don't pre-process markdown in WordDisplay

Since we are update words inline, changes in markdown are not shown unless
they are re-rendered, which class variables are not. This should hopefully
not be too big a processing power hit for large lists, but stress testing
should be performed to make sure.
This commit is contained in:
Robbie Antenesse 2017-12-10 14:24:16 -07:00
parent 0a9259ec56
commit 0c4824e430
1 changed files with 1 additions and 9 deletions

View File

@ -24,14 +24,6 @@ export class WordDisplay extends Component {
menuIsOpen: false, menuIsOpen: false,
isEditing: false, isEditing: false,
} }
this.wordDetailsHTML = marked(props.word.details);
}
componentWillUpdate (nextProps, nextState) {
if (this.props.word.details !== nextProps.word.details) {
this.wordDetailsHTML = marked(nextProps.word.details);
}
} }
edit () { edit () {
@ -158,7 +150,7 @@ export class WordDisplay extends Component {
(word.details) (word.details)
&& ( && (
<p className='word-details' <p className='word-details'
dangerouslySetInnerHTML={{__html: this.wordDetailsHTML}} /> dangerouslySetInnerHTML={{__html: marked(word.details)}} />
) )
} }
</div> </div>