From 6733323d81f4ef706a0c6af971853d7a3b683c53 Mon Sep 17 00:00:00 2001 From: Matija Obreza Date: Thu, 22 Oct 2020 20:20:07 +0200 Subject: [PATCH] Bugs --- workspaces/ui-express/src/actions/navigation.ts | 2 +- workspaces/ui-express/src/institutes/ui/DisplayPage.tsx | 6 +++--- workspaces/ui-express/src/ui/App.tsx | 8 ++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/workspaces/ui-express/src/actions/navigation.ts b/workspaces/ui-express/src/actions/navigation.ts index 81e19a8a..de6402bb 100644 --- a/workspaces/ui-express/src/actions/navigation.ts +++ b/workspaces/ui-express/src/actions/navigation.ts @@ -3,7 +3,7 @@ import { stringify } from 'query-string'; const IN_BROWSER = typeof window !== 'undefined'; -export function navigateTo(path: string, query?: object) { +export function navigateTo(path: string, query?: Record) { return (dispatch, getState) => { if (! IN_BROWSER) { console.log('Not navigating anywhere while on the server!'); diff --git a/workspaces/ui-express/src/institutes/ui/DisplayPage.tsx b/workspaces/ui-express/src/institutes/ui/DisplayPage.tsx index 3a457c6f..fca23db6 100644 --- a/workspaces/ui-express/src/institutes/ui/DisplayPage.tsx +++ b/workspaces/ui-express/src/institutes/ui/DisplayPage.tsx @@ -168,8 +168,8 @@ class DisplayPage extends React.Component { public componentDidUpdate(prevProps: Readonly): void { const { code: oldCode } = prevProps; - const { code, loadInstitute, institute } = this.props; - if (code && (! institute || code !== institute.details.code) || code !== oldCode) { + const { loading, code, loadInstitute, institute } = this.props; + if (code && !loading && (!institute || code !== institute.details.code) || code !== oldCode) { loadInstitute(code); } } @@ -182,7 +182,7 @@ class DisplayPage extends React.Component { let cropNameOverview; let taxonomyGenusOverview; let taxonomyGenusSpeciesOverview; - if (!loading) { + if (!loading && institute) { const cropShortNameKey = 'crop.shortName'; cropShortNameOverview = institute.overview[cropShortNameKey]; const cropNameKey = 'cropName'; diff --git a/workspaces/ui-express/src/ui/App.tsx b/workspaces/ui-express/src/ui/App.tsx index e46e1c3b..a0cb6704 100644 --- a/workspaces/ui-express/src/ui/App.tsx +++ b/workspaces/ui-express/src/ui/App.tsx @@ -7,7 +7,7 @@ import { updateHistory } from 'actions/history'; import { loadCrops } from 'crop/actions/public'; import { initMyList } from 'list/actions/public'; import { initMyMaps } from 'accessions/actions/public'; -import { checkSoftwareVersion, serverInfoRequest } from 'actions/serverInfo'; +import { serverInfoRequest } from 'actions/serverInfo'; import { loadIso3Decodings, refreshIso3Decodings } from 'geo/actions/public'; import { withRouter } from 'react-router-dom'; @@ -34,7 +34,6 @@ interface IAppProps extends React.ClassAttributes, WithTranslation { loadIso3Decodings: (lang: string) => void; serverInfo: any; serverInfoRequest: any; - checkSoftwareVersion: any; initMyMaps: any; refreshIso3Decodings: (lang: string) => void; lang: string; @@ -47,7 +46,7 @@ class App extends React.Component { } public componentDidMount() { - const { initMyList, checkSoftwareVersion , initMyMaps, refreshIso3Decodings, lang } = this.props; + const { initMyList, initMyMaps, refreshIso3Decodings, lang } = this.props; const { crops, loadCrops, serverInfo, serverInfoRequest} = this.props; if (! crops || crops.length === 0) { loadCrops(); @@ -60,8 +59,6 @@ class App extends React.Component { initMyList(); initMyMaps(); refreshIso3Decodings(lang); - console.log('Loading software version'); - checkSoftwareVersion(); } public componentDidUpdate(prevProps: IAppProps) { @@ -114,7 +111,6 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({ loadCrops, initMyList, serverInfoRequest, - checkSoftwareVersion, loadIso3Decodings, initMyMaps, refreshIso3Decodings, -- GitLab