mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-14 07:00:51 -04:00
fix(client): keep logs while executing challenge (#51671)
This commit is contained in:
committed by
GitHub
parent
5c8b94f236
commit
10ea10cefb
@@ -40,13 +40,13 @@ export const actionTypes = createTypes(
|
||||
'challengeMounted',
|
||||
'sendRenderTime',
|
||||
'checkChallenge',
|
||||
'executeChallenge',
|
||||
'resetChallenge',
|
||||
'stopResetting',
|
||||
'resetAttempts',
|
||||
'setEditorFocusability',
|
||||
'toggleVisibleEditor',
|
||||
...createAsyncTypes('submitChallenge')
|
||||
...createAsyncTypes('submitChallenge'),
|
||||
...createAsyncTypes('executeChallenge')
|
||||
],
|
||||
ns
|
||||
);
|
||||
|
||||
@@ -70,6 +70,9 @@ export const challengeMounted = createAction(actionTypes.challengeMounted);
|
||||
export const sendRenderTime = createAction(actionTypes.sendRenderTime);
|
||||
export const checkChallenge = createAction(actionTypes.checkChallenge);
|
||||
export const executeChallenge = createAction(actionTypes.executeChallenge);
|
||||
export const executeChallengeComplete = createAction(
|
||||
actionTypes.executeChallengeComplete
|
||||
);
|
||||
export const resetChallenge = createAction(actionTypes.resetChallenge);
|
||||
export const stopResetting = createAction(actionTypes.stopResetting);
|
||||
export const submitChallenge = createAction(actionTypes.submitChallenge);
|
||||
|
||||
@@ -38,6 +38,7 @@ import { executeGA } from '../../../redux/actions';
|
||||
import { actionTypes } from './action-types';
|
||||
import {
|
||||
disableBuildOnError,
|
||||
executeChallengeComplete,
|
||||
initConsole,
|
||||
initLogs,
|
||||
logsToConsole,
|
||||
@@ -51,6 +52,7 @@ import {
|
||||
challengeMetaSelector,
|
||||
challengeTestsSelector,
|
||||
isBuildEnabledSelector,
|
||||
isExecutingSelector,
|
||||
portalDocumentSelector
|
||||
} from './selectors';
|
||||
|
||||
@@ -147,6 +149,7 @@ function* executeChallengeSaga({ payload }) {
|
||||
} catch (e) {
|
||||
yield put(updateConsole(e));
|
||||
} finally {
|
||||
yield put(executeChallengeComplete());
|
||||
consoleProxy.close();
|
||||
}
|
||||
}
|
||||
@@ -230,7 +233,10 @@ function* previewChallengeSaga({ flushLogs = true } = {}) {
|
||||
const proxyLogger = args => logProxy.put(args);
|
||||
|
||||
try {
|
||||
if (flushLogs) {
|
||||
const isExecuting = yield select(isExecutingSelector);
|
||||
// executeChallengeSaga flushes the logs, so there's no need to if that's
|
||||
// just happened.
|
||||
if (flushLogs && !isExecuting) {
|
||||
yield put(initLogs());
|
||||
yield put(initConsole(''));
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ const initialState = {
|
||||
userCompletedExam: null,
|
||||
hasCompletedBlock: false,
|
||||
isBuildEnabled: true,
|
||||
isExecuting: false,
|
||||
isResetting: false,
|
||||
logsOut: [],
|
||||
modal: {
|
||||
@@ -234,7 +235,12 @@ export const reducer = handleActions(
|
||||
[actionTypes.executeChallenge]: state => ({
|
||||
...state,
|
||||
currentTab: 3,
|
||||
attempts: state.attempts + 1
|
||||
attempts: state.attempts + 1,
|
||||
isExecuting: true
|
||||
}),
|
||||
[actionTypes.executeChallengeComplete]: state => ({
|
||||
...state,
|
||||
isExecuting: false
|
||||
}),
|
||||
[actionTypes.setEditorFocusability]: (state, { payload }) => ({
|
||||
...state,
|
||||
|
||||
@@ -40,6 +40,7 @@ export const isSubmittingSelector = state => state[ns].isSubmitting;
|
||||
export const isResettingSelector = state => state[ns].isResetting;
|
||||
|
||||
export const isBuildEnabledSelector = state => state[ns].isBuildEnabled;
|
||||
export const isExecutingSelector = state => state[ns].isExecuting;
|
||||
export const successMessageSelector = state => state[ns].successMessage;
|
||||
|
||||
export const projectFormValuesSelector = state =>
|
||||
|
||||
Reference in New Issue
Block a user