Commit 6733323d authored by Matija Obreza's avatar Matija Obreza

Bugs

parent 5a200cee
......@@ -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<string, string | number | boolean>) {
return (dispatch, getState) => {
if (! IN_BROWSER) {
console.log('Not navigating anywhere while on the server!');
......
......@@ -168,8 +168,8 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
public componentDidUpdate(prevProps: Readonly<IDisplayPageProps>): 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<IDisplayPageProps, any> {
let cropNameOverview;
let taxonomyGenusOverview;
let taxonomyGenusSpeciesOverview;
if (!loading) {
if (!loading && institute) {
const cropShortNameKey = 'crop.shortName';
cropShortNameOverview = institute.overview[cropShortNameKey];
const cropNameKey = 'cropName';
......
......@@ -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<any>, 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<IAppProps, any> {
}
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<IAppProps, any> {
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment