Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Apr 11, 2024
1 parent 4ae2b3a commit 17ba234
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/cypress/e2e/navigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('navigation', () => {
it('access to country detail page', () => {
cy.visit('/').wait(10000);
cy.get('a[data-cy="sidebar-tab-countries"]').click({ force: true }).wait(1000);
cy.get('a[data-cy="country-item-link"]').first().click();
cy.get('a[data-cy="country-item-link"]').first().click().wait(10000);
cy.get('[data-cy="country-detail-name"]').should('exist');
});

Expand Down
7 changes: 4 additions & 3 deletions client/src/containers/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import { LngLatBoundsLike, MapLayerMouseEvent, useMap } from 'react-map-gl';

import dynamic from 'next/dynamic';
import { useParams, useRouter } from 'next/navigation';
import { useParams, usePathname, useRouter } from 'next/navigation';

import bbox from '@turf/bbox';
import { useAtomValue, useSetAtom, useAtom } from 'jotai';
Expand Down Expand Up @@ -67,6 +67,7 @@ export default function MapContainer() {
const { [id]: map } = useMap();
const { push } = useRouter();
const params = useParams<{ id: string }>();
const pathname = usePathname();

const layersInteractiveIds = useAtomValue(layersInteractiveIdsAtom);
const setHoveredProjectMap = useSetAtom(hoveredProjectMapAtom);
Expand Down Expand Up @@ -129,7 +130,7 @@ export default function MapContainer() {
}, [map, setBboxURL, setTmpBbox]);

useEffect(() => {
if (map && map.getSource('projects') && params.id) {
if (map && map.getSource('projects') && params.id && pathname.includes('projects')) {
const projectFeatures = map?.querySourceFeatures('projects', {
sourceLayer: 'areas_centroids_c',
filter: ['==', 'project_code', params.id],
Expand All @@ -141,7 +142,7 @@ export default function MapContainer() {
});
setTmpBbox(bboxTurf as Bbox);
}
}, [map, params.id, setTmpBbox]);
}, [map, params.id, setTmpBbox, pathname]);

const handleMapClick = useCallback(
(e: MapLayerMouseEvent) => {
Expand Down

0 comments on commit 17ba234

Please sign in to comment.