refactor(react-doctor): raise score from 79 to 90

This commit is contained in:
plebeius
2026-02-24 15:15:44 +08:00
parent 5bd1dc0e71
commit e51f5b968c
36 changed files with 2372 additions and 1030 deletions
+6 -2
View File
@@ -1,8 +1,10 @@
import { create } from 'zustand';
import { Challenge } from '@plebbit/plebbit-react-hooks';
let nextChallengeId = 0;
interface State {
challenges: Challenge[];
challenges: Array<{ challenge: Challenge; id: number }>;
addChallenge: (challenge: Challenge) => void;
removeChallenge: () => void;
}
@@ -10,7 +12,9 @@ interface State {
const useChallengesStore = create<State>((set) => ({
challenges: [],
addChallenge: (challenge: Challenge) => {
set((state) => ({ challenges: [...state.challenges, challenge] }));
set((state) => ({
challenges: [...state.challenges, { challenge, id: nextChallengeId++ }],
}));
},
removeChallenge: () => {
set((state) => {