-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hds 1168 fix dateinput perf #909
Conversation
Warning from Tooltip tests:
Needs some investigation |
Latest version is not compatible with React 17
I had to downgrade react-popper because the latest version is not probably compatible with React 17 |
@@ -300,11 +303,18 @@ export const DatePicker = (providedProps: DayPickerProps) => { | |||
|
|||
const currentMonthAvailableDays: number[] = currentMonthAvailableDates.map((date) => date.getDate()); | |||
|
|||
const onPopperRender = React.useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onPopperReady
@@ -76,6 +76,8 @@ export const DatePicker = (providedProps: DayPickerProps) => { | |||
*/ | |||
const [selectedDate, setSelectedDate] = useState<Date>(selected || null); | |||
|
|||
const [isReadyToShow, setIsReadyToShow] = useState<boolean>(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isPopperReady, setIsPopperReady
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- rename constants
// Initialize Popper.js | ||
const { styles: datePickerPopperStyles, attributes: datePickerPopperAttributes } = usePopper( | ||
inputRef.current, | ||
pickerWrapperRef.current, | ||
{ | ||
onFirstUpdate: onPopperRender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try Popper lifecycle methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- use lifecycle methods
// Initialize Popper.js | ||
const { styles: datePickerPopperStyles, attributes: datePickerPopperAttributes } = usePopper( | ||
inputRef.current, | ||
pickerWrapperRef.current, | ||
{ | ||
onFirstUpdate: onPopperRender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add explanatory comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good fixes to tests and needless rendering 🏅
Description
Related Issues
Motivation and Context
How Has This Been Tested?
Demo