From 604da6e6046e6f49a8307c9bbe83cfd739c37e38 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Fri, 14 Sep 2018 17:19:33 +0200 Subject: [PATCH] fix: Only add the level ID when it has not been looked at before --- src/pages/level.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/level.tsx b/src/pages/level.tsx index b6ca5ac..890ad99 100644 --- a/src/pages/level.tsx +++ b/src/pages/level.tsx @@ -54,13 +54,13 @@ export default class LevelPage extends React.Component { // Check if the vocab was already looked at const lookedAt = this.state.lookedAt.find((el) => el === vocab.id) || vocab.id === 0; - // TODO: Actually update the "Vocab View" when clicking return { // Prevent the user from using too much memory by always clicking on the elements // Show the clicked at vocab word + this.setState({ currentVocab: vocab, - lookedAt: this.state.lookedAt.concat(vocab.id), + lookedAt: lookedAt ? this.state.lookedAt : this.state.lookedAt.concat(vocab.id), }); }}>