Skip to content

fix: fetch next batch if event types are empty and cursor exists#17109

Merged
pumfleet merged 17 commits intomainfrom
fix/personal-event-types
Nov 13, 2024
Merged

fix: fetch next batch if event types are empty and cursor exists#17109
pumfleet merged 17 commits intomainfrom
fix/personal-event-types

Conversation

@Udit-takkar
Copy link
Copy Markdown
Contributor

@Udit-takkar Udit-takkar commented Oct 15, 2024

What does this PR do?

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • N/A I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Login in as enterprise@example.com

  1. Go to /event-types
  2. and try creating new user event types,managed event types or team events

Check whether all event types are loaded

@graphite-app graphite-app Bot requested a review from a team October 15, 2024 08:37
@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Oct 15, 2024
@dosubot dosubot Bot added event-types area: event types, event-types 🐛 bug Something isn't working labels Oct 15, 2024
@Udit-takkar Udit-takkar marked this pull request as draft October 15, 2024 08:37
@linear
Copy link
Copy Markdown

linear Bot commented Oct 15, 2024

@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Oct 15, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (10/15/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (10/30/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (11/11/24)

1 label was added to this PR based on Keith Williams's automation.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 2:04pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 2:04pm

Comment on lines +63 to +67
while (eventTypes.length < limit && (currentCursor || isFetchingForFirstTime)) {
await fetchAndFilterEventTypes();
isFetchingForFirstTime = false;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch event types till eventTypes.length>=limit.

const eventTypes: MappedEventType[] = [];
let currentCursor = cursor;
let nextCursor: typeof cursor | undefined = undefined;
let isFetchingForFirstTime = true;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isFetchingForFirstTime is required to prevent infinite while loop when user doesn't have any event types

@Udit-takkar Udit-takkar marked this pull request as draft October 15, 2024 13:40
@dosubot dosubot Bot added this to the v4.7 milestone Oct 16, 2024
@Udit-takkar Udit-takkar added the high-risk Requires approval by Foundation team label Oct 30, 2024
Copy link
Copy Markdown
Member

@alishaz-polymath alishaz-polymath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 11, 2024

E2E results are ready!

Comment thread packages/trpc/server/routers/viewer/eventTypes/getEventTypesFromGroup.handler.ts Outdated
…omGroup.handler.ts

Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO event-types area: event types, event-types High priority Created by Linear-GitHub Sync high-risk Requires approval by Foundation team ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-4516] No Personal event types showing up on /event-types page

6 participants