calcom / cal.com

Scheduling infrastructure for absolutely everyone.
https://cal.com
Other
31.88k stars 7.8k forks source link

Showing blank notification box and negative numbers for recurring events #9604

Closed ericrommel closed 1 year ago

ericrommel commented 1 year ago

Found a bug? Please fill out the sections below. 👍

Issue Summary

When there are 5 or less than that, it's showing 0 or the difference between 5 and the recurring numbers. Also, an empty/blank notification box is shown.

Steps to Reproduce

  1. Set a recurring event type with 3 events recurring (issue is between 5 and 1)
  2. Copy the event link and open it in another tab
  3. Set a day and time
  4. Check the list of events. You can see a "-2" together with "+ more"
  5. Mouse over that list to see the blank box notification

Tested on Vercel preview (https://cal-5luk9i0hk-cal.vercel.app/event-types)

Technical details

image

image

image

image

image

kemilbeltre commented 1 year ago

@ericrommel could you assign this to me? Thanks

kemilbeltre commented 1 year ago

Hey, @ericrommel checking the code above, it seems to be not possible to reproduce this error:

{!rescheduleUid && eventType?.recurringEvent?.freq && recurringStrings.length > 5 && (
                        <div className="flex">
                          <Tooltip
                            content={recurringStrings.slice(5).map((timeFormatted, key) => (
                              <p key={key}>{timeFormatted}</p>
                            ))}>
                            <p className=" text-sm">
                              + {t("plus_more", { count: recurringStrings.length })}
                            </p>
                          </Tooltip>
                        </div>
                      )}

Do you think I'm missing something?

kemilbeltre commented 1 year ago

In order to avoid a negative length we can use the + to convert a string representation of a number to a number.

ericrommel commented 1 year ago

Hey @kemilbeltre, where are you testing that? Are using the Vercel preview?

kemilbeltre commented 1 year ago

Hey @kemilbeltre, where are you testing that? Are using the Vercel preview?

Hi @ericrommel I'm just running the app locally. I don't have a user to access Vercel Preview. :)