Skip to content

Conversation

@sieu-db
Copy link
Collaborator

@sieu-db sieu-db commented Feb 10, 2025

Important

Fixes infinite loop in DatePicker by refining date validation logic and updates example to demonstrate the fix.

  • Behavior:
    • Fixes infinite loop in DatePicker component in DatePicker.tsx by refining date validation logic to handle minimumDate and maximumDate more precisely.
    • Adds a new DatePicker instance in DatePickerExample.jsx with minimumDate set to current date to demonstrate the fix.
  • Code Changes:
    • Refines date validation logic in DatePicker.tsx to set date only if it is outside the minimumDate and maximumDate range.
    • Adds date4 state and corresponding DatePicker in DatePickerExample.jsx to test the new logic.

This description was created by Ellipsis for 81f615e. It will automatically update as commits are pushed.

@linear
Copy link

linear bot commented Feb 10, 2025

type={"solid"}
date={date4}
format={"mmm d, yyyy hh:MM tt"}
minimumDate={new Date()}
Copy link

Choose a reason for hiding this comment

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

Avoid creating a new Date() inline for the minimumDate prop as it creates a new instance every render, which may trigger repeated state updates. Consider memoizing the value.

@github-actions
Copy link

Published version: @draftbit/ui@52.1.4-91f8c4.2

@sieu-db sieu-db merged commit 1498e8a into 52-beta Feb 10, 2025
1 check passed
@sieu-db sieu-db deleted the sieu/p-5973-fix-inifinity-loop-date-picker-52 branch February 10, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants