Skip to content

useDateTimeRangePicker causing continuous re-renders #2848

Closed

Description

@benjaminleonard

Because we're using maxValue as a prop to useDateTimeRangePicker which is set to now(getLocalTimeZone()) (to prevent a user from setting and end time beyond the current moment). It's continuously causing re-renders in any component that calls it.

It'd obviously defeat the point if we memoized the current time. I thought we could call now() within the DateRangePicker itself at change time but it seems like the props are just forwarded to useDateRangePickerState. We can investigate further, maybe there's react-aria feature that'll handle this for us.

Don't think this is actually the reason, since now() will just get called when the component re-renders. Something else is afoot.

Activity

  1. changed the title [-]`useDateTimeRangePicker` continuously re-renders[/-] [+]`useDateTimeRangePicker` causing continuous re-renders[/+] on Jul 8, 2025
  2. benjaminleonard commented on Jul 8, 2025

    @benjaminleonard
    ContributorAuthor

    Image

  3. david-crespo commented on Jul 8, 2025

    @david-crespo
    Collaborator

    Great illustration. I will look at this.

  4. benjaminleonard commented on Jul 8, 2025

    @benjaminleonard
    ContributorAuthor

    If it helps, I think it is resolved removing useDebounce in useDateTimeRangePicker. Could be a good place to start.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions