Skip to content

Commit

Permalink
Merge pull request #58 from varun2948/fix/-faster-load-project-list-w…
Browse files Browse the repository at this point in the history
…ith-no-map-omit

Fix/ faster load project list with no map omit
  • Loading branch information
varun2948 authored Feb 14, 2024
2 parents d916da7 + c054519 commit df668e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion frontend/src/components/projectDetail/downloadOsmData.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export const DownloadOsmData = ({ projectMappingTypes, project }) => {
window.focus();
if (window._paq) {
// Check if Matomo tracking array (_paq) exists
window._paq.push(['trackEvent', 'OSMDownloads', 'Click', `${title}_${fileFormat}`]);
window._paq.push([
'trackEvent',
'OSMDownloads',
'Click',
`${project.projectId}_${title}_${fileFormat}`,
]);
}
// Check if the request was successful
if (responsehead.ok) {
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/components/projects/projectNav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
import { useSelector, useDispatch } from 'react-redux';
Expand Down Expand Up @@ -84,7 +84,18 @@ export const ProjectNav = (props) => {
const encodedParams = stringify(fullProjectsQuery)
? ['?', stringify(fullProjectsQuery)].join('')
: '';
const isMapShown = useSelector((state) => state.preferences['mapShown']);

useEffect(() => {
setQuery(
{
...fullProjectsQuery,
omitMapResults:!isMapShown
},
'pushIn',
);
// eslint-disable-next-line react-hooks/exhaustive-deps
},[isMapShown])
const linkCombo = 'link ph3 f6 pv2 ba b--tan br1 ph3 fw5';

const moreFiltersAnyActive =
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/hooks/UseProjectsQueryAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const projectQueryAllSpecification = {
stale: BooleanParam,
createdFrom: StringParam,
basedOnMyInterests: BooleanParam,
omitMapResults: BooleanParam,
};

/* This can be passed into project API or used independently */
Expand Down Expand Up @@ -70,6 +71,7 @@ const backendToQueryConversion = {
stale: 'lastUpdatedTo',
createdFrom: 'createdFrom',
basedOnMyInterests: 'basedOnMyInterests',
omitMapResults:'omitMapResults',
};

const dataFetchReducer = (state, action) => {
Expand Down

0 comments on commit df668e7

Please sign in to comment.