Fix calendar IDs with # character breaking navigation#39
Conversation
Calendar IDs containing # (e.g. en.gh#holiday@group.v.calendar.google.com) were broken because # is interpreted as a URL fragment by the browser, causing everything after it to be silently dropped from the route param. Encode calendar ID with encodeURIComponent when navigating and decode with decodeURIComponent when reading from useParams. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR ReviewSummaryThis PR correctly fixes the issue where calendar IDs containing Implementation AnalysisWhat's correct: Potential Issue: Missing Error HandlingBug - Missing try/catch for In Current code: const calendarId = rawCalendarId ? decodeURIComponent(rawCalendarId) : undefined;Recommended fix: const calendarId = rawCalendarId
? (() => {
try {
return decodeURIComponent(rawCalendarId);
} catch {
// If decoding fails, treat as invalid calendar ID
return undefined;
}
})()
: undefined;This prevents the app from crashing if a user manually edits the URL to include malformed percent-encoding. The existing error handling in Test Plan VerificationThe test plan correctly covers:
Recommendation: Add a test case for malformed URL encoding to verify graceful handling. VerdictApprove with suggested fix - The core fix is correct and solves the reported issue. The error handling improvement is a defensive measure for edge cases involving manual URL manipulation. |
Summary
#(e.g.en.gh#holiday@group.v.calendar.google.com) were broken because the browser interprets#as a URL fragment identifier, silently dropping everything after it from the route paramencodeURIComponentwhen navigating from CalendarList, and decode withdecodeURIComponentwhen reading fromuseParamsin CalendarDetailTest plan
#in its ID (e.g. holiday calendars) and verify it loads correctly🤖 Generated with Claude Code