Skip to content

Fix: Null-guard Calendar onSelect handlers for cleared ranges - #41

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sh-student-app-36-calendar-crash
Open

Fix: Null-guard Calendar onSelect handlers for cleared ranges#41
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sh-student-app-36-calendar-crash

Conversation

@sentry

@sentry sentry Bot commented Aug 11, 2026

Copy link
Copy Markdown

This PR addresses issue SH-STUDENT-APP-36, a TypeError occurring when a user clears a date range selection in the Calendar component.

Problem: The react-day-picker component, when in mode="range", calls its onSelect handler with undefined when the user clears or deselects a previously chosen date range. The existing handlers in src/pages/(dash)/assignment/[id]/page.tsx and src/pages/(dash)/work-log/log-date-list/page.tsx unconditionally attempted to access properties like e.from and e.to, leading to a TypeError: undefined is not an object.

Solution:

  • Implemented optional chaining (e?.from, e?.to) when accessing properties of the e (date range) object within the onSelect handlers.
  • Modified the condition for calling loadPage to if (e && form.formState.isValid) to ensure that loadPage is only triggered when a valid date range (e is not undefined) is selected, preventing unnecessary page reloads on deselection.

Fixes SH-STUDENT-APP-36
Fixes TECH-2216

@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown

TECH-2216

@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for studenthub-student ready!

Name Link
🔨 Latest commit 1b60412
🔍 Latest deploy log https://app.netlify.com/projects/studenthub-student/deploys/6a7b01c6b6d7290008aefef5
😎 Deploy Preview https://deploy-preview-41--studenthub-student.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

0 participants