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

Possible Bug with Duplicated Dates on Drag Selection #52

Open
nktnet1 opened this issue Jan 12, 2022 · 0 comments
Open

Possible Bug with Duplicated Dates on Drag Selection #52

nktnet1 opened this issue Jan 12, 2022 · 0 comments

Comments

@nktnet1
Copy link

nktnet1 commented Jan 12, 2022

Hi,

I believe there's an issue with the dates being duplicated in the date array passed into "onChange".
This can be reproduced by:

  1. Select a cell (e.g. Cell A).
  2. Click an unselected cell (e.g. Cell B) and simultaneously drag it onto the selected Cell A.

Array will contain ["Cell A", "Cell B", "Cell A"].

Problem reproducible in sandbox:
https://codesandbox.io/s/objective-pateu-y8lr0?file=/src/App.js

Currently using the following as a temporary workaround:

  const [schedule, setSchedule] = React.useState([])

  // ...

  const handleChange = (newSchedule) => {
    // setSchedule(schedule) // has duplicates - below will filter date to be unique.
    setSchedule([...new Set(schedule.map(date => +date))].map(timestamp => new Date(timestamp)));
  }

Thanks :) - Really appreciate your work!

@nktnet1 nktnet1 changed the title Possible Bugs with Duplicates Date Possible Bug with Duplicates Date on Drag Selection Jan 12, 2022
@nktnet1 nktnet1 changed the title Possible Bug with Duplicates Date on Drag Selection Possible Bug with Duplicated Dates on Drag Selection Jan 12, 2022
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

No branches or pull requests

1 participant