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

[Bug Report] VCalendar regression in click handler when dealing with string categories #12922

Closed
gregveres opened this issue Jan 7, 2021 · 1 comment · Fixed by #13270
Closed
Labels
C: VCalendar VCalendar T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke
Milestone

Comments

@gregveres
Copy link

Environment

Vuetify Version: 2.4.2
Last working version: 2.3.23
Vue Version: 2.6.12
Browsers: Edge 87.0.664.66
OS: Windows 10

Steps to reproduce

In v2.4, support for categories as objects was added. This seems to have introduced breaking changes to people who are using categories as an array of strings.
Specifically, I use the @mousedown:time-category event handler. This handler is passed an event with a category field. That field is now a category object always. The reproduction link above creates a simple calendar with 2 categories that are simple strings cat 1 and cat 2. The handler receives the event and dumps it to the console.

Note that when you click on the calendar, the event dumped to the console includes a category object with the name of the category in categoryName rather than category being a string as it used to be. This breaks all the code that used to process these events expecting the category to be a string.

Also, the docs have not been updated to reflect that category can be an object now and not just a string.

Expected Behavior

the object dumped to the console should have shown category: 'cat 1'

Actual Behavior

the object dumped to the console now shows category as an object:
{ categoryName: 'cat 1' }

Reproduction Link

https://codepen.io/gregveres-the-looper/pen/BaLVvjK?editors=1111

@ghost ghost added the S: triage label Jan 7, 2021
@ElijahKotyluk ElijahKotyluk added C: VCalendar VCalendar T: documentation T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke and removed T: documentation S: triage labels Jan 10, 2021
@KaelWD
Copy link
Member

KaelWD commented Mar 9, 2021

@nquinn721 This could be if (typeof category === 'string') return category right? You're already returning an array of bare strings a couple lines above.

if (typeof categories === 'string') return categories.split(/\s*,\s/)
if (Array.isArray(categories)) {
return categories.map((category: CalendarCategory) => {
if (typeof category === 'string') return { categoryName: category }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VCalendar VCalendar T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants