fix(contributions): auto-redirect vers la concention collective quand celle-ci a été sauvegardée dans le header#7203
Open
fix(contributions): auto-redirect vers la concention collective quand celle-ci a été sauvegardée dans le header#7203
Conversation
revu-bot
reviewed
Mar 27, 2026
Collaborator
revu-bot
left a comment
There was a problem hiding this comment.
PR Review: Auto-redirect to collective agreement page from header
This PR implements auto-redirection to a CC-specific contribution page when a collective agreement has been previously saved in localStorage (via the site header). The implementation is generally clean and well-tested, but there are a few issues worth addressing.
| File | Lines | Severity | Issue |
|---|---|---|---|
ContributionGeneric.tsx |
58–71 | CRITICAL | Missing redirect loop guard — unpublished CC can cause infinite redirect |
ContributionGeneric.tsx |
58–71 | IMPORTANT | useEffect with empty deps array accesses stale slug/contribution via closure |
ContributionGeneric.tsx |
63–65 | IMPORTANT | Hardcoded slug string is a fragile magic constant |
contributions.test.tsx |
308–385 | IMPORTANT | Tests don't clear localStorage between cases — state leaks between tests |
revu-bot
reviewed
Mar 27, 2026
Comment on lines
+65
to
+68
| const targetUrl = | ||
| slug === "les-conges-pour-evenements-familiaux" | ||
| ? `/contribution/${slug}/${storedAgreement.slug || storedAgreement.num}` | ||
| : `/contribution/${storedAgreement.num}-${slug}`; |
Collaborator
There was a problem hiding this comment.
[IMPORTANT] Hardcoded slug string is a fragile magic constant
- If the slug for "congés pour événements familiaux" ever changes (rename, typo fix, etc.), this silent branch will silently stop working with no compile-time error.
- The special-casing logic is duplicated here and likely elsewhere in the codebase.
Proposed fix: Extract this to a named constant (or derive it from the contribution data) so the intent is clear and the value is maintained in one place.
Suggested change
| const targetUrl = | |
| slug === "les-conges-pour-evenements-familiaux" | |
| ? `/contribution/${slug}/${storedAgreement.slug || storedAgreement.num}` | |
| : `/contribution/${storedAgreement.num}-${slug}`; | |
| const CONGES_FAMILIAUX_SLUG = "les-conges-pour-evenements-familiaux"; | |
| const targetUrl = | |
| slug === CONGES_FAMILIAUX_SLUG | |
| ? `/contribution/${slug}/${storedAgreement.slug || storedAgreement.num}` | |
| : `/contribution/${storedAgreement.num}-${slug}`; |
|
|
🎉 Deployment for commit 41a9201 : IngressesDocker images
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



fix #7182