fix(client): keep challengeFile order on update (#44722)
* fix: keep challengeFile order on update * refactor: name variable challengeFile, not file Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> * fix: prettify Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
committed by
GitHub
parent
54317be92f
commit
2952f9399d
@ -231,13 +231,11 @@ export const reducer = handleActions(
|
||||
);
|
||||
return {
|
||||
...state,
|
||||
challengeFiles: [
|
||||
...state.challengeFiles.filter(x => x.fileKey !== fileKey),
|
||||
{
|
||||
...state.challengeFiles.find(x => x.fileKey === fileKey),
|
||||
...updates
|
||||
}
|
||||
]
|
||||
challengeFiles: state.challengeFiles.map(challengeFile =>
|
||||
challengeFile.fileKey === fileKey
|
||||
? { ...challengeFile, ...updates }
|
||||
: { ...challengeFile }
|
||||
)
|
||||
};
|
||||
},
|
||||
[actionTypes.storedCodeFound]: (state, { payload }) => ({
|
||||
|
Reference in New Issue
Block a user