From b2cfbfcdb2e1b8daf95a08c3b2c4dd585d27ccc3 Mon Sep 17 00:00:00 2001 From: Xavier Jp Date: Tue, 11 Jun 2024 14:43:50 +0200 Subject: [PATCH] fix: loader not trigger on active tab and other glitches (#1108) * fix: loader not trigger on active tab * feat: add github link in footer * chore: add OSM copyright * chore: add maplibre link * feat: pass domain in context rather than excpetion body * feat: increase ODS timeout to 20sec except JOAFE which is synchrone with /immatriculations page --- clients/api-entreprise/client.ts | 3 ++- .../clients/journal-officiel-associations/index.ts | 6 +++++- clients/open-data-soft/index.ts | 9 +++++++-- components/footer/index.tsx | 10 ++++++++++ components/map/map-etablissement.tsx | 5 +++++ components/map/map-results.tsx | 5 +++++ components/search-results/map/index.tsx | 2 +- components/title-section/tabs/tab-link.tsx | 4 +++- models/exceptions.ts | 1 + 9 files changed, 39 insertions(+), 6 deletions(-) diff --git a/clients/api-entreprise/client.ts b/clients/api-entreprise/client.ts index 16f6fc3f4..f9c95f5b1 100644 --- a/clients/api-entreprise/client.ts +++ b/clients/api-entreprise/client.ts @@ -30,7 +30,8 @@ export default async function clientAPIEntreprise( logInfoInSentry( new Information({ name: 'NoRecipientSiretForAgent', - message: `Fallback on Dinum siret for domain : ${callerInfos.domain}`, + message: 'Fallback on Dinum siret', + context: { domain: callerInfos.domain }, }) ); } diff --git a/clients/open-data-soft/clients/journal-officiel-associations/index.ts b/clients/open-data-soft/clients/journal-officiel-associations/index.ts index 0eb926fdc..88d3eca98 100644 --- a/clients/open-data-soft/clients/journal-officiel-associations/index.ts +++ b/clients/open-data-soft/clients/journal-officiel-associations/index.ts @@ -1,6 +1,7 @@ import routes from '#clients/routes'; import { stubClient } from '#clients/stub-client-with-snaphots'; import { IAnnoncesAssociation } from '#models/annonces'; +import constants from '#models/constants'; import { IdRna, Siren, formatDateLong } from '#utils/helpers'; import { getFiscalYear } from '#utils/helpers/formatting/format-fiscal-year'; import odsClient from '../..'; @@ -65,7 +66,10 @@ type IDCAField = { const clientJOAFE = async (idRna: string): Promise => { const searchUrl = `${routes.journalOfficielAssociations.ods.search}&q=numero_rna=${idRna}&refine.source=joafe&sort=dateparution`; const metaDataUrl = routes.journalOfficielAssociations.ods.metadata; - const response = await odsClient({ url: searchUrl }, metaDataUrl); + const response = await odsClient( + { url: searchUrl, config: { timeout: constants.timeout.L } }, + metaDataUrl + ); return { annonces: response.records.map( diff --git a/clients/open-data-soft/index.ts b/clients/open-data-soft/index.ts index 4a4174618..1c907e5e5 100644 --- a/clients/open-data-soft/index.ts +++ b/clients/open-data-soft/index.ts @@ -1,3 +1,4 @@ +import constants from '#models/constants'; import { IDefaultRequestConfig, httpGet } from '#utils/network'; import { IODSMetadata, IODSResponse } from './types'; @@ -8,9 +9,13 @@ const odsClient = async ( search: { url: string; config?: IDefaultRequestConfig }, metaDataUrl: string ): Promise => { + const timeout = constants.timeout.XXL; const [response, responseMetaData] = await Promise.all([ - httpGet(search.url, search.config), - httpGet(metaDataUrl), + httpGet(search.url, { + timeout, + ...search.config, + }), + httpGet(metaDataUrl, { timeout }), ]); const results = response || []; diff --git a/components/footer/index.tsx b/components/footer/index.tsx index b6ac44148..cc30b3910 100644 --- a/components/footer/index.tsx +++ b/components/footer/index.tsx @@ -392,6 +392,16 @@ const Footer = () => ( Historique des changements +
  • + + Code source + +
  • diff --git a/components/map/map-etablissement.tsx b/components/map/map-etablissement.tsx index 72aadfc26..580eb75ba 100644 --- a/components/map/map-etablissement.tsx +++ b/components/map/map-etablissement.tsx @@ -33,6 +33,11 @@ export function MapEtablissement({ center: coords, zoom, minZoom: 3, + attributionControl: { + compact: true, + customAttribution: + 'MapLibre © OpenMapTiles © Contributeurs OpenStreetMap', + }, }); const popup = new maplibregl.Popup({ offset: 30 }).setHTML( diff --git a/components/map/map-results.tsx b/components/map/map-results.tsx index 07d96622e..9e1ea5ee8 100644 --- a/components/map/map-results.tsx +++ b/components/map/map-results.tsx @@ -33,6 +33,11 @@ export default function MapWithResults({ center: [2, 47], zoom: 4.5, minZoom: 3, + attributionControl: { + compact: true, + customAttribution: + 'MapLibre © OpenMapTiles © Contributeurs OpenStreetMap', + }, }); results.results.forEach((result) => { diff --git a/components/search-results/map/index.tsx b/components/search-results/map/index.tsx index 0f9378849..671b7d8ab 100644 --- a/components/search-results/map/index.tsx +++ b/components/search-results/map/index.tsx @@ -13,7 +13,7 @@ const SearchResultsMap: React.FC<{ results: ISearchResults; searchFilterParams?: IParams; }> = ({ results, searchTerm = '', searchFilterParams = {} }) => { - const height = 'calc(100vh - 260px)'; + const height = 'calc(100vh - 265px)'; if (searchTerm && results.notEnoughParams) { return ( diff --git a/components/title-section/tabs/tab-link.tsx b/components/title-section/tabs/tab-link.tsx index b5441bc4a..e3f6f8668 100644 --- a/components/title-section/tabs/tab-link.tsx +++ b/components/title-section/tabs/tab-link.tsx @@ -30,7 +30,9 @@ export default function TabLink({ rel={noFollow ? 'nofollow' : ''} style={{ width }} scroll={false} - onClick={() => window.dispatchEvent(new Event('runloadbar'))} + onClick={() => + active ? null : window.dispatchEvent(new Event('runloadbar')) + } prefetch={false} > {active ? label :

    {label}

    } diff --git a/models/exceptions.ts b/models/exceptions.ts index 357ce5981..b853cb27f 100644 --- a/models/exceptions.ts +++ b/models/exceptions.ts @@ -23,6 +23,7 @@ type IExceptionArgument = { referrer?: string; browser?: string; digest?: string; + domain?: string; }; };