mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(client): use source head/tail if challenge is saved (#55596)
This commit is contained in:
parent
2610a39539
commit
2f59fee0c2
@ -176,11 +176,11 @@ const defaultOutput = `
|
||||
*/`;
|
||||
|
||||
function ShowClassic({
|
||||
challengeFiles: reduxChallengeFiles,
|
||||
challengeFiles,
|
||||
data: {
|
||||
challengeNode: {
|
||||
challenge: {
|
||||
challengeFiles,
|
||||
challengeFiles: seedChallengeFiles,
|
||||
block,
|
||||
title,
|
||||
description,
|
||||
@ -363,7 +363,7 @@ function ShowClassic({
|
||||
});
|
||||
|
||||
createFiles(
|
||||
mergeChallengeFiles(challengeFiles, savedChallenge?.challengeFiles)
|
||||
mergeChallengeFiles(seedChallengeFiles, savedChallenge?.challengeFiles)
|
||||
);
|
||||
|
||||
initTests(tests);
|
||||
@ -416,9 +416,9 @@ function ShowClassic({
|
||||
isUsingKeyboardInTablist
|
||||
}: RenderEditorArgs) => {
|
||||
return (
|
||||
reduxChallengeFiles && (
|
||||
challengeFiles && (
|
||||
<MultifileEditor
|
||||
challengeFiles={reduxChallengeFiles}
|
||||
challengeFiles={challengeFiles}
|
||||
block={block}
|
||||
superBlock={superBlock}
|
||||
containerRef={containerRef}
|
||||
@ -482,7 +482,7 @@ function ShowClassic({
|
||||
)}
|
||||
{!isMobile && (
|
||||
<DesktopLayout
|
||||
challengeFiles={reduxChallengeFiles}
|
||||
challengeFiles={challengeFiles}
|
||||
challengeType={challengeType}
|
||||
editor={renderEditor({
|
||||
isMobileLayout: false,
|
||||
|
||||
@ -2,6 +2,7 @@ import { isEmpty } from 'lodash-es';
|
||||
import { handleActions } from 'redux-actions';
|
||||
|
||||
import { getLines } from '../../../../../shared/utils/get-lines';
|
||||
import { mergeChallengeFiles } from '../classic/saved-challenges';
|
||||
import { getTargetEditor } from '../utils/get-target-editor';
|
||||
import { actionTypes, ns } from './action-types';
|
||||
import codeStorageEpic from './code-storage-epic';
|
||||
@ -110,7 +111,9 @@ export const reducer = handleActions(
|
||||
},
|
||||
[actionTypes.storedCodeFound]: (state, { payload }) => ({
|
||||
...state,
|
||||
challengeFiles: payload
|
||||
challengeFiles: state.challengeFiles.length
|
||||
? mergeChallengeFiles(state.challengeFiles, payload)
|
||||
: payload
|
||||
}),
|
||||
[actionTypes.initTests]: (state, { payload }) => ({
|
||||
...state,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user