Skip to content

Commit

Permalink
fix: loader not trigger on active tab and other glitches (#1108)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
XavierJp authored Jun 11, 2024
1 parent fba58d7 commit b2cfbfc
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 6 deletions.
3 changes: 2 additions & 1 deletion clients/api-entreprise/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default async function clientAPIEntreprise<T, U>(
logInfoInSentry(
new Information({
name: 'NoRecipientSiretForAgent',
message: `Fallback on Dinum siret for domain : ${callerInfos.domain}`,
message: 'Fallback on Dinum siret',
context: { domain: callerInfos.domain },
})
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 '../..';
Expand Down Expand Up @@ -65,7 +66,10 @@ type IDCAField = {
const clientJOAFE = async (idRna: string): Promise<IAnnoncesAssociation> => {
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(
Expand Down
9 changes: 7 additions & 2 deletions clients/open-data-soft/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import constants from '#models/constants';
import { IDefaultRequestConfig, httpGet } from '#utils/network';
import { IODSMetadata, IODSResponse } from './types';

Expand All @@ -8,9 +9,13 @@ const odsClient = async (
search: { url: string; config?: IDefaultRequestConfig },
metaDataUrl: string
): Promise<any> => {
const timeout = constants.timeout.XXL;
const [response, responseMetaData] = await Promise.all([
httpGet<IODSResponse>(search.url, search.config),
httpGet<IODSMetadata>(metaDataUrl),
httpGet<IODSResponse>(search.url, {
timeout,
...search.config,
}),
httpGet<IODSMetadata>(metaDataUrl, { timeout }),
]);

const results = response || [];
Expand Down
10 changes: 10 additions & 0 deletions components/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,16 @@ const Footer = () => (
Historique des changements
</a>
</li>
<li className="fr-footer__bottom-item">
<a
className="fr-footer__bottom-link"
target="_blank"
rel="noreferrer noopener"
href="https://github.com/annuaire-entreprises-data-gouv-fr"
>
Code source
</a>
</li>
</ul>
<div className="fr-footer__bottom-copy">
<p>
Expand Down
5 changes: 5 additions & 0 deletions components/map/map-etablissement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export function MapEtablissement({
center: coords,
zoom,
minZoom: 3,
attributionControl: {
compact: true,
customAttribution:
'<a href="https://maplibre.org/" target="_blank">MapLibre</a> <a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© Contributeurs OpenStreetMap</a>',
},
});

const popup = new maplibregl.Popup({ offset: 30 }).setHTML(
Expand Down
5 changes: 5 additions & 0 deletions components/map/map-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export default function MapWithResults({
center: [2, 47],
zoom: 4.5,
minZoom: 3,
attributionControl: {
compact: true,
customAttribution:
'<a href="https://maplibre.org/" target="_blank">MapLibre</a> <a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© Contributeurs OpenStreetMap</a>',
},
});

results.results.forEach((result) => {
Expand Down
2 changes: 1 addition & 1 deletion components/search-results/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 3 additions & 1 deletion components/title-section/tabs/tab-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 : <h2>{label}</h2>}
Expand Down
1 change: 1 addition & 0 deletions models/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type IExceptionArgument = {
referrer?: string;
browser?: string;
digest?: string;
domain?: string;
};
};

Expand Down

0 comments on commit b2cfbfc

Please sign in to comment.