Skip to content

Commit 2c9abdb

Browse files
committed
Fix achievement inferencer memoization
It was previously not reupdating properly when new data is fetched from the backend.
1 parent 864a641 commit 2c9abdb

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/pages/achievement/control/AchievementControl.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,13 @@ const AchievementControl: React.FC = () => {
3535
[dispatch]
3636
);
3737

38-
// TODO: This is a hacky fix. By right, we shouldn't need to use an
39-
// inferencer instance since we can encapsulate the logic using hooks
40-
// and component state.
4138
const [initialAchievements, initialGoals] = useTypedSelector(state => [
4239
state.achievement.achievements,
4340
state.achievement.goals
4441
]);
4542
const inferencer = useMemo(
4643
() => new AchievementInferencer(initialAchievements, initialGoals),
47-
// We only want to create the inferencer once
48-
// eslint-disable-next-line react-hooks/exhaustive-deps
49-
[]
44+
[initialAchievements, initialGoals]
5045
);
5146

5247
/**

0 commit comments

Comments
 (0)