fix(storybook): disable logger network send in Storybook
Set VITE_STORYBOOK=true for storybook dev/build so the logger never sends POST to /logs/frontend in the isolated UI environment. Prevents 94+ failed network requests in audit and keeps Storybook hermetic. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
7b1ec1fb12
commit
bd8ef90ef6
3 changed files with 11 additions and 8 deletions
|
|
@ -38,8 +38,8 @@
|
|||
"qa:a11y": "make a11y",
|
||||
"qa:all": "make qa-all",
|
||||
"prepare": "husky",
|
||||
"storybook": "cross-env VITE_API_URL=/api/v1 VITE_USE_MSW=true storybook dev -p 6006",
|
||||
"build-storybook": "cross-env VITE_API_URL=/api/v1 VITE_USE_MSW=true storybook build"
|
||||
"storybook": "cross-env VITE_API_URL=/api/v1 VITE_USE_MSW=true VITE_STORYBOOK=true storybook dev -p 6006",
|
||||
"build-storybook": "cross-env VITE_API_URL=/api/v1 VITE_USE_MSW=true VITE_STORYBOOK=true storybook build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
|
|
|
|||
|
|
@ -94,12 +94,14 @@ function formatLog(
|
|||
console.log(jsonLog);
|
||||
|
||||
// FIX #19: Envoi optionnel vers endpoint de logging (si configuré)
|
||||
// Par défaut, utiliser l'endpoint backend si VITE_LOG_ENDPOINT n'est pas défini
|
||||
const logEndpoint =
|
||||
import.meta.env.VITE_LOG_ENDPOINT ||
|
||||
(import.meta.env.VITE_API_URL
|
||||
? `${import.meta.env.VITE_API_URL}/logs/frontend`
|
||||
: null);
|
||||
// Skip sending in Storybook so no network calls run in isolated UI environment
|
||||
const isStorybook = import.meta.env.VITE_STORYBOOK === 'true';
|
||||
const logEndpoint = isStorybook
|
||||
? null
|
||||
: (import.meta.env.VITE_LOG_ENDPOINT ||
|
||||
(import.meta.env.VITE_API_URL
|
||||
? `${import.meta.env.VITE_API_URL}/logs/frontend`
|
||||
: null));
|
||||
|
||||
// Envoyer tous les logs (pas seulement les erreurs) vers le backend pour archivage
|
||||
if (logEndpoint) {
|
||||
|
|
|
|||
1
apps/web/src/vite-env.d.ts
vendored
1
apps/web/src/vite-env.d.ts
vendored
|
|
@ -8,6 +8,7 @@ interface ImportMetaEnv {
|
|||
readonly VITE_APP_NAME: string;
|
||||
readonly VITE_DEBUG: string;
|
||||
readonly VITE_USE_MSW: string;
|
||||
readonly VITE_STORYBOOK?: string;
|
||||
readonly VITE_FCM_VAPID_KEY: string;
|
||||
// more env variables...
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue