Skip to content

Commit

Permalink
fix: average state bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-1806 committed Feb 16, 2024
1 parent 04a1ee3 commit 01fc543
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Leaderboard/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function PaginatedItems(props: LeaderboardType.Props) {
.catch(error => {
if (error instanceof ApiError) Toast.error(error.message);
});
changeEditorGameType(GameType.PVP);
dispatch(changeEditorGameType(GameType.PVP));
setShow(false);
}
return (
Expand Down
9 changes: 9 additions & 0 deletions src/store/editor/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ export const editorSlice = createSlice({

changeEditorGameType: (state, action: PayloadAction<GameType>) => {
state.gameType = action.payload;
if (action.payload === GameType.NORMAL) {
state.userCode =
state.allLanguagesNormalCode[
languagesAvailable.indexOf(state.language)
];
} else {
state.userCode =
state.allLanguagesPvPCode[languagesAvailable.indexOf(state.language)];
}
},
},
});
Expand Down

0 comments on commit 01fc543

Please sign in to comment.