fix: Only add the level ID when it has not been looked at before
This commit is contained in:
parent
d8c49fde9c
commit
604da6e604
@ -54,13 +54,13 @@ export default class LevelPage extends React.Component<IProps, IState> {
|
|||||||
// Check if the vocab was already looked at
|
// Check if the vocab was already looked at
|
||||||
const lookedAt = this.state.lookedAt.find((el) => el === vocab.id) || vocab.id === 0;
|
const lookedAt = this.state.lookedAt.find((el) => el === vocab.id) || vocab.id === 0;
|
||||||
|
|
||||||
// TODO: Actually update the "Vocab View" when clicking
|
|
||||||
return <ListItem button key={this.genUID(vocab)} onClick={() => {
|
return <ListItem button key={this.genUID(vocab)} onClick={() => {
|
||||||
// Prevent the user from using too much memory by always clicking on the elements
|
// Prevent the user from using too much memory by always clicking on the elements
|
||||||
// Show the clicked at vocab word
|
// Show the clicked at vocab word
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
currentVocab: vocab,
|
currentVocab: vocab,
|
||||||
lookedAt: this.state.lookedAt.concat(vocab.id),
|
lookedAt: lookedAt ? this.state.lookedAt : this.state.lookedAt.concat(vocab.id),
|
||||||
});
|
});
|
||||||
}}>
|
}}>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
|
Reference in New Issue
Block a user