fix: handle the sorting of transformed files (#44724)
* fix: handle the sorting of transformed files We can't use the ext property, since that is transformed, but the history is maintained. * test: make solutions polyVinyls for sorting * refactor: inline prepareChallenge * refactor: make solutions polys in getChallenges * fix: convert each solution to a poly * fix: skip empty solutions * fix: get challenge file history in client * refactor: stop calling isPoly from the client * fix: remove debug console.log * refactor: remove unnecessary sorting step
This commit is contained in:
committed by
GitHub
parent
b1fb6adc39
commit
cacc4eacd7
@@ -95,10 +95,12 @@ exports.createPages = function createPages({ graphql, actions, reporter }) {
|
||||
contents
|
||||
head
|
||||
tail
|
||||
history
|
||||
}
|
||||
solutions {
|
||||
contents
|
||||
ext
|
||||
history
|
||||
}
|
||||
superBlock
|
||||
superOrder
|
||||
|
@@ -547,6 +547,7 @@ export const query = graphql`
|
||||
head
|
||||
tail
|
||||
editableRegionBoundaries
|
||||
history
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ import { isEmpty } from 'lodash-es';
|
||||
import { createAction, handleActions } from 'redux-actions';
|
||||
|
||||
import { getLines } from '../../../../../utils/get-lines';
|
||||
import { createPoly } from '../../../../../utils/polyvinyl';
|
||||
import { challengeTypes } from '../../../../utils/challenge-types';
|
||||
import { completedChallengesSelector } from '../../../redux';
|
||||
import { getTargetEditor } from '../utils/getTargetEditor';
|
||||
@@ -58,12 +57,11 @@ export const sagas = [
|
||||
...createCurrentChallengeSaga(actionTypes)
|
||||
];
|
||||
|
||||
// TODO: can createPoly handle editable region, rather than separating it?
|
||||
export const createFiles = createAction(
|
||||
actionTypes.createFiles,
|
||||
challengeFiles =>
|
||||
challengeFiles.map(challengeFile => ({
|
||||
...createPoly(challengeFile),
|
||||
...challengeFile,
|
||||
seed: challengeFile.contents.slice(),
|
||||
editableContents: getLines(
|
||||
challengeFile.contents,
|
||||
|
@@ -1,5 +1,4 @@
|
||||
const path = require('path');
|
||||
const { createPoly } = require('../../../utils/polyvinyl');
|
||||
const { dasherize } = require('../../../utils/slugs');
|
||||
const { sortChallengeFiles } = require('../../../utils/sort-challengefiles');
|
||||
const { challengeTypes, viewTypes } = require('../challenge-types');
|
||||
@@ -115,12 +114,10 @@ function getProjectPreviewConfig(challenge, allChallengeEdges) {
|
||||
const lastChallengeFiles = sortChallengeFiles(
|
||||
lastChallenge.challengeFiles ?? []
|
||||
);
|
||||
const projectPreviewChallengeFiles = lastChallengeFiles.map((file, id) =>
|
||||
createPoly({
|
||||
...file,
|
||||
contents: solutionToLastChallenge[id]?.contents ?? file.contents
|
||||
})
|
||||
);
|
||||
const projectPreviewChallengeFiles = lastChallengeFiles.map((file, id) => ({
|
||||
...file,
|
||||
contents: solutionToLastChallenge[id]?.contents ?? file.contents
|
||||
}));
|
||||
|
||||
return {
|
||||
showProjectPreview:
|
||||
|
Reference in New Issue
Block a user