{
const isAideFinanciere = resolveAidType(aide.aid_types_full) === TypeAidesTerritoiresAide.financement;
- const estimationId = +useParams().estimationId;
+ const estimationId = useParams().estimationId;
const projet = useProjetsStore((state) => state.getCurrentProjet());
const canEditProjet = useCanEditProjet(projet?.id);
@@ -31,7 +31,7 @@ export const AideFiche = ({ aide }: AideFicheProps) => {
id="financement-panel"
>
{!!estimationId && canEditProjet && (
-
+
)}
{
const [expanded, setExpanded] = useState(false);
const filter = filters.find((f) => f.code === code);
- const filterRef = useRef(null);
+ const filterRef = useRef(null);
useClickOutsideManagement({
ref: filterRef,
action: () => {
diff --git a/src/components/sourcing/sourcing-layout-button.tsx b/src/components/sourcing/sourcing-layout-button.tsx
index 535c8913..0ff7ca25 100644
--- a/src/components/sourcing/sourcing-layout-button.tsx
+++ b/src/components/sourcing/sourcing-layout-button.tsx
@@ -18,13 +18,15 @@ export const SourcingLayoutButton = () => {
>
Revenir au tableau de bord
-
-
-
- Voir mes contacts sélectionnés
-
-
-
+ {projetId && (
+
+
+
+ Voir mes contacts sélectionnés
+
+
+
+ )}
);
};
diff --git a/src/components/tableau-de-bord/tableau-de-bord-suivi-card.tsx b/src/components/tableau-de-bord/tableau-de-bord-suivi-card.tsx
index 4624358c..eab24c71 100644
--- a/src/components/tableau-de-bord/tableau-de-bord-suivi-card.tsx
+++ b/src/components/tableau-de-bord/tableau-de-bord-suivi-card.tsx
@@ -39,6 +39,9 @@ export const TableauDeBordSuiviCard = ({
const disabledTextClass = disabled ? "text-pfmv-grey" : "text-dsfr-background-flat-blue-france";
const { projetId } = useParams();
const linkResolver = makeUrl[type];
+ if (!projetId) {
+ return null;
+ }
return (
;
+ ref: RefObject
;
action: () => void;
};
diff --git a/src/instrumentation.ts b/src/instrumentation.ts
new file mode 100644
index 00000000..ecb65282
--- /dev/null
+++ b/src/instrumentation.ts
@@ -0,0 +1,13 @@
+import * as Sentry from "@sentry/nextjs";
+
+export async function register() {
+ if (process.env.NEXT_RUNTIME === "nodejs") {
+ await import("../sentry.server.config");
+ }
+
+ if (process.env.NEXT_RUNTIME === "edge") {
+ await import("../sentry.edge.config");
+ }
+}
+
+export const onRequestError = Sentry.captureRequestError;
diff --git a/src/stores/modal/provider.tsx b/src/stores/modal/provider.tsx
index 3e9bd27c..a942cc42 100644
--- a/src/stores/modal/provider.tsx
+++ b/src/stores/modal/provider.tsx
@@ -11,10 +11,7 @@ export interface ModalStoreProviderProps {
}
export const ModalStoreProvider = ({ children }: ModalStoreProviderProps) => {
- const storeRef = useRef>();
- if (!storeRef.current) {
- storeRef.current = createModalStore(initModalStore());
- }
+ const storeRef = useRef>(createModalStore(initModalStore()));
return {children};
};
diff --git a/src/stores/projets/provider.tsx b/src/stores/projets/provider.tsx
index d1b26535..a7f4be9c 100644
--- a/src/stores/projets/provider.tsx
+++ b/src/stores/projets/provider.tsx
@@ -1,9 +1,9 @@
"use client";
-import { type ReactNode, createContext, useRef, useContext } from "react";
+import { createContext, type ReactNode, useContext, useRef } from "react";
import { type StoreApi, useStore } from "zustand";
-import { type ProjetsStore, createProjetStore, initProjetsStore } from "@/src/stores/projets/store";
+import { createProjetStore, initProjetsStore, type ProjetsStore } from "@/src/stores/projets/store";
export const ProjetsStoreContext = createContext | null>(null);
@@ -12,10 +12,7 @@ export interface ProjetsStoreProviderProps {
}
export const ProjetsStoreProvider = ({ children }: ProjetsStoreProviderProps) => {
- const storeRef = useRef>();
- if (!storeRef.current) {
- storeRef.current = createProjetStore(initProjetsStore());
- }
+ const storeRef = useRef>(createProjetStore(initProjetsStore()));
return {children};
};
diff --git a/src/stores/user/provider.tsx b/src/stores/user/provider.tsx
index 2fc4a351..b24b43fe 100644
--- a/src/stores/user/provider.tsx
+++ b/src/stores/user/provider.tsx
@@ -11,10 +11,7 @@ export interface UserStoreProviderProps {
}
export const UserStoreProvider = ({ children }: UserStoreProviderProps) => {
- const storeRef = useRef>();
- if (!storeRef.current) {
- storeRef.current = createUserStore(initUserStore());
- }
+ const storeRef = useRef>(createUserStore(initUserStore()));
return {children};
};
diff --git a/src/types/global.d.ts b/src/types/global.d.ts
index 219fbf4d..0dede158 100644
--- a/src/types/global.d.ts
+++ b/src/types/global.d.ts
@@ -19,12 +19,12 @@ export type DSFRModal = {
};
export type Page = {
- params: {
+ params: Promise<{
[key: string]: string;
- };
- searchParams: {
+ }>;
+ searchParams: Promise<{
[key: string]: string;
- };
+ }>;
};
declare global {