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:
parent
0a9259ec56
commit
0c4824e430
src/components/display/WordDisplay
|
@ -24,14 +24,6 @@ export class WordDisplay extends Component {
|
|||
menuIsOpen: 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 () {
|
||||
|
@ -158,7 +150,7 @@ export class WordDisplay extends Component {
|
|||
(word.details)
|
||||
&& (
|
||||
<p className='word-details'
|
||||
dangerouslySetInnerHTML={{__html: this.wordDetailsHTML}} />
|
||||
dangerouslySetInnerHTML={{__html: marked(word.details)}} />
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue