Skip to content
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

fixes #2424 - fix js error TypeError: Cannot read properties of undef… #2528

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LorienHW
Copy link

@LorienHW LorienHW commented Mar 4, 2024

…ined (reading 'getDate')

see issue 2424

you can repro the issue by clicking around a selectable month view of the calendar a lot and it helps to press keys at the same time (as is mentioned in the issue)

i think whats happening is that handleSelectSlot sets the _pendingSelection but then calls selectDates via setTimeout, and before selectDates executes something else calls clearSelection which empties out the _pendingSelection array. I've tested this fix and it seems to work - exiting early results in the slot not appearing selected and the onSelectSlot callback not being called

@forceddd
Copy link
Contributor

forceddd commented Apr 2, 2024

@LorienHW Hi,this bug seems to be because the keydown event triggers the click behavior as a select behavior. I think this should be a logical bug with the Selector.What do you think?

@LorienHW
Copy link
Author

LorienHW commented Apr 2, 2024

the handleSelectSlot function sets the _pendingSelection and then uses a setTimeout to call selectDates. Because its not called synchronously there is an opportunity for clearSelection to be called by something else (for example a key press), and empties out the _pendingSelection array (which is what i see happening in testing it). So just based on this sequence of code, since it is possible to get into selectDates with an empty _pendingSelection I think it should verify that there is something in there rather than assuming it has at least one item (which is what the change in this PR does)

@forceddd
Copy link
Contributor

forceddd commented Apr 3, 2024

Yes, you have a point. But this modification only silences this error in Month View. You will find another bug when you first select an area and then hold down the left mouse button while pressing the keyboard again.This video shows this performance

2024-04-02.15.13.55.mov

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.

2 participants