From ea4972ba9d2e5f539cb5a3141e9d2080a361d0c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne2@student.uni-halle.de> Date: Tue, 12 Nov 2019 11:21:35 +0100 Subject: [PATCH] - fixed isse where we can't save/update a custom project after creation because the component was not re-mounted (and no new ids are loaded) --- src/app.tsx | 10 ++++++++-- .../descriptionEditorPanelView.tsx | 4 ++-- .../manageCustomProjectsSite/headerBarContent.tsx | 2 -- src/constants.ts | 2 +- .../editCustomProjectSite/editCustomProjectActions.ts | 1 - 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index c90903d4..769e3555 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -225,8 +225,9 @@ class App extends React.Component<Props, any> { { //edit custom projects site (create, edit) + //maybe the key is not needed here but why not } - <Route exact path={constants.createCustomProjectSiteToLinkPath} + <Route exact key={constants.createCustomProjectSiteToLinkPath} path={constants.createCustomProjectSiteToLinkPath} render={(props: RouteComponentProps<any>) => <PageContentWrapper headerBar={ @@ -239,7 +240,12 @@ class App extends React.Component<Props, any> { </PageContentWrapper> }/> - <Route exact path={constants.getCustomProjectMatchLinkPath} render={(props: RouteComponentProps<any>) => + { + //we need key to re-mount component so we fully load the new project after creation + //see https://github.com/ReactTraining/react-router/issues/1703 + //see https://stackoverflow.com/questions/47804798/how-to-re-render-the-same-component-being-used-in-different-routes + } + <Route exact key={constants.getCustomProjectMatchLinkPath} path={constants.getCustomProjectMatchLinkPath} render={(props: RouteComponentProps<any>) => <PageContentWrapper headerBar={ <CommonHeaderBar> diff --git a/src/components/sites/exerciseEditorSite/descriptionEditorPanel/descriptionEditorPanelView.tsx b/src/components/sites/exerciseEditorSite/descriptionEditorPanel/descriptionEditorPanelView.tsx index bb6b4f18..ba5b7bd8 100644 --- a/src/components/sites/exerciseEditorSite/descriptionEditorPanel/descriptionEditorPanelView.tsx +++ b/src/components/sites/exerciseEditorSite/descriptionEditorPanel/descriptionEditorPanelView.tsx @@ -13,6 +13,7 @@ import { descriptionEditorDebounceInMs, editExerciseExerciseDescriptionEditorPanelViewEditorId } from '../../../../constants' +import {getNextFrontendId} from '../../../../helpers/frontendIdHelper' //const css = require('./styles.styl'); @@ -29,8 +30,7 @@ const mapStateToProps = (rootState: RootState, props: MyProps) => { return { //test0: rootState... //test: props.test - descriptionContent: props.descriptionContent, - setContent: props.setContent, + ...props, } } diff --git a/src/components/sites/manageCustomProjectsSite/headerBarContent.tsx b/src/components/sites/manageCustomProjectsSite/headerBarContent.tsx index c55a2153..25a5188a 100644 --- a/src/components/sites/manageCustomProjectsSite/headerBarContent.tsx +++ b/src/components/sites/manageCustomProjectsSite/headerBarContent.tsx @@ -54,8 +54,6 @@ class headerBar extends React.Component<Props, any> { render(): JSX.Element { - console.log(this.props.systemSettings) - const leftArea = ( <div className="flexed"> diff --git a/src/constants.ts b/src/constants.ts index cc214edb..673e724f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -13,7 +13,7 @@ import Logger from './helpers/logger' * y - breaking changes / new features * z - fixes, small changes */ -export const versionString = '2.5.9' +export const versionString = '2.5.11' export const supportMail = 'yapex@informatik.uni-halle.de' diff --git a/src/state/actions/editCustomProjectSite/editCustomProjectActions.ts b/src/state/actions/editCustomProjectSite/editCustomProjectActions.ts index 929fe3c2..7b7ef031 100644 --- a/src/state/actions/editCustomProjectSite/editCustomProjectActions.ts +++ b/src/state/actions/editCustomProjectSite/editCustomProjectActions.ts @@ -311,7 +311,6 @@ export function loadEditCustomProjectSite(customProjectId: number | null, isCrea await dispatch(getCustomProjectAsync(customProjectId)) - await dispatch(getCustomProjectTestResultsAsync(customProjectId, getState().editCustomProjectSiteState.customProject.solution.pLangId)) // await dispatch( -- GitLab