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 {
|
return {
|
||||||
...state,
|
...state,
|
||||||
challengeFiles: [
|
challengeFiles: state.challengeFiles.map(challengeFile =>
|
||||||
...state.challengeFiles.filter(x => x.fileKey !== fileKey),
|
challengeFile.fileKey === fileKey
|
||||||
{
|
? { ...challengeFile, ...updates }
|
||||||
...state.challengeFiles.find(x => x.fileKey === fileKey),
|
: { ...challengeFile }
|
||||||
...updates
|
)
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[actionTypes.storedCodeFound]: (state, { payload }) => ({
|
[actionTypes.storedCodeFound]: (state, { payload }) => ({
|
||||||
|
Reference in New Issue
Block a user