Skip to content

fix(sentry): correction des erreurs remontées par Sentry#7225

Open
m-maillot wants to merge 1 commit intodevfrom
fix/sentry-issues
Open

fix(sentry): correction des erreurs remontées par Sentry#7225
m-maillot wants to merge 1 commit intodevfrom
fix/sentry-issues

Conversation

@m-maillot
Copy link
Copy Markdown
Contributor

  • Suppression du Sentry.captureMessage sur les pages 404 (bruit inutile)
  • Remplacement des IDs non-déterministes (uuid, Math.random) par des IDs stables pour corriger les erreurs d'hydration React
  • Ajout d'un auto-reload sur ChunkLoadError pour gérer les anciens chunks après redéploiement
  • Amélioration du reporting d'erreur du simulateur d'embauche avec captureException et contexte

@revu-bot revu-bot bot requested a review from revu-bot April 8, 2026 14:25
@m-maillot m-maillot temporarily deployed to build-preproduction April 8, 2026 14:25 — with GitHub Actions Inactive
};

export default function Index() {
Sentry.captureMessage("Page non trouvée");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Les 404 n'ont pas vocation a être récupéré dans Sentry. D'autant plus qu'on ne sait pas les analyser tellement il y en a.

Copy link
Copy Markdown
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: fix(sentry) — Sentry noise reduction & hydration fixes

This PR addresses several legitimate issues: removing noisy 404 Sentry messages, fixing React hydration errors from non-deterministic IDs, adding ChunkLoadError auto-reload, and improving error reporting in the hiring simulator. The overall direction is correct, but there are a few issues worth addressing.

File Lines Severity Issue
app/error.tsx 22–24 CRITICAL Infinite reload loop on persistent ChunkLoadError
app/error.tsx 15–19 MINOR reset prop accepted but never used
src/modules/common/DisplayContent.tsx 48–55 IMPORTANT Index-based IDs break accordion stability on reorder/filter
src/modules/outils/simulateur-embauche/HiringSimulator.tsx 42–46 IMPORTANT event: String(event) may truncate useful event data

Comment thread packages/code-du-travail-frontend/app/error.tsx
...(isParent
? { id: slugify(item.title) }
: { id: slugify(item.title) + "_" + generateUUID() }),
: { id: slugify(item.title) + "_" + index }),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca c'est à vérifier ! Car on avait pas mal de soucis sur les accordéons ! Je vais passer sur les écrans qui posaient soucis.

- Suppression du Sentry.captureMessage sur les pages 404 (bruit inutile)
- Remplacement des IDs non-déterministes (uuid, Math.random) par des IDs stables pour corriger les erreurs d'hydration React
- Ajout d'un auto-reload sur ChunkLoadError pour gérer les anciens chunks après redéploiement
- Amélioration du reporting d'erreur du simulateur d'embauche avec captureException et contexte

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@m-maillot m-maillot force-pushed the fix/sentry-issues branch from 357f142 to 5eb0d98 Compare April 9, 2026 07:13
@m-maillot m-maillot temporarily deployed to build-preproduction April 9, 2026 07:13 — with GitHub Actions Inactive
@m-maillot m-maillot temporarily deployed to build-review-auto April 9, 2026 07:14 — with GitHub Actions Inactive
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

@tokenbureau
Copy link
Copy Markdown

tokenbureau bot commented Apr 9, 2026

@m-maillot m-maillot requested review from maxgfr and revu-bot April 9, 2026 15:22
Copy link
Copy Markdown
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: fix(sentry) — Sentry noise reduction & hydration fixes

This PR addresses several legitimate Sentry issues: removing noisy 404 captures, fixing hydration mismatches from non-deterministic IDs, adding a ChunkLoadError auto-reload guard, and improving error context in the hiring simulator. The overall direction is correct, but there are a few issues worth addressing.

File Lines Severity Issue
app/error.tsx 22–30 CRITICAL reset prop accepted but never used; ChunkLoadError reload shows error UI before reloading
app/error.tsx 22–30 IMPORTANT sessionStorage access not guarded against SSR/private-browsing errors
src/modules/common/DisplayContent.tsx 52–57 IMPORTANT Index-based IDs break accordion identity on reorder/filter
src/modules/outils/simulateur-embauche/HiringSimulator.tsx 42–47 MINOR event: String(event) may truncate useful Event object data

Copy link
Copy Markdown
Member

@maxgfr maxgfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice le skill :)

Actuellement, il n'y a pas d'alternative concernant le fait d'avoir un folder lié à Claude Code avec un .claude :(

Comment on lines +22 to +29
if (error.name === "ChunkLoadError") {
const key = `chunk-reload:${error.message}`;
if (!sessionStorage.getItem(key)) {
sessionStorage.setItem(key, "1");
window.location.reload();
return;
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est spécifique comme fix cela ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants