Skip to content

perf: fetch server side data for workflow details page #20778

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

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

TusharBhatt1
Copy link
Contributor

@TusharBhatt1 TusharBhatt1 commented Apr 20, 2025

What does this PR do?

This PR moves all the /workflows/[id] data fetching to server side.

Visual Demo (For contributors especially)

Before :
image
After:
image

dynamic-worklflows.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • 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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Summary by mrge

Moved all data fetching for the /workflows/[id] page to the server side to improve performance and reliability.

  • Refactors
    • Replaced client-side data fetching with server-side calls for workflow details, user info, and related data.
    • Updated components to accept server-fetched data as props.

Copy link

vercel bot commented Apr 20, 2025

@TusharBhatt1 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Apr 20, 2025
@graphite-app graphite-app bot requested a review from a team April 20, 2025 16:31
Copy link
Contributor

github-actions bot commented Apr 20, 2025

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Perf/fetch server side data for dynamic webflow page". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@keithwillcode keithwillcode added the community-interns The team responsible for reviewing, testing and shipping low/medium community PRs label Apr 20, 2025
@dosubot dosubot bot added performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive workflows area: workflows, automations labels Apr 20, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

mrge found 3 issues across 5 files. View them in mrge.io

Copy link

graphite-app bot commented Apr 20, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (04/20/25)

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

"Add community label" took an action on this PR • (04/20/25)

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

@TusharBhatt1 TusharBhatt1 changed the title Perf/fetch server side data for dynamic webflow page perf: fetch server side data for dynamic webflow page Apr 20, 2025
teamId: workflow?.team?.id,
},
{ enabled: !verifiedEmailsProp }
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to server side

Copy link
Contributor

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

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

Great job Tushar! That was fast. But this requires some changes.

@github-actions github-actions bot marked this pull request as draft April 21, 2025 14:11
Copy link
Contributor

github-actions bot commented Apr 21, 2025

E2E results are ready!

@TusharBhatt1 TusharBhatt1 marked this pull request as ready for review April 21, 2025 14:38
@TusharBhatt1
Copy link
Contributor Author

Great job Tushar! That was fast. But this requires some changes.

Thanks @hbjORbj , I have addresed them all - can you have a look

@hbjORbj hbjORbj changed the title perf: fetch server side data for dynamic webflow page perf: fetch server side data for workflow details page Apr 21, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

mrge found 3 issues across 7 files. View them in mrge.io

// teamId: workflow?.team?.id,
// });
// } catch (err) {}
const [verifiedEmails, verifiedNumbers, eventsData, user, actionOptions] = await Promise.all([
Copy link
Contributor

Choose a reason for hiding this comment

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

Using index-based destructuring from Promise.all results can be error-prone if the order of promises changes in the future.

// teamId: workflow?.team?.id,
// });
// } catch (err) {}
const [verifiedEmails, verifiedNumbers, eventsData, user, actionOptions] = await Promise.all([
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing error handling for Promise.all. If any of these async calls fail, the entire page will fail.

@hbjORbj
Copy link
Contributor

hbjORbj commented Apr 21, 2025

@TusharBhatt1 Please review my comments more carefully and only ping me after more careful review of your code yourself. As I mentioned before, let's minimize the number of ping pongs as much as possible. Don't wanna spend 7-8 ping-pongs on a small change like the last time.

Copy link
Contributor

github-actions bot commented May 8, 2025

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label May 8, 2025
@anikdhabal
Copy link
Contributor

Closing due to inactivity. Feel free to tag me if you wanted to continue 🙏

@anikdhabal anikdhabal closed this Jun 19, 2025
@Amit91848 Amit91848 reopened this Jun 29, 2025
Copy link
Contributor

@Amit91848 Amit91848 left a comment

Choose a reason for hiding this comment

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

Can follow the new pattern here as well 🙏

Comment on lines 45 to 49
const [workflowCaller, eventCaller, userCaller] = await Promise.all([
createRouterCaller(workflowsRouter),
createRouterCaller(eventTypesRouter),
createRouterCaller(meRouter),
]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can directly use Repository methods inside unstable_cache here wherever possible
https://github.com/calcom/cal.com/pull/20773/files#r2173620412

Comment on lines 59 to 63
const [verifiedEmails, verifiedNumbers, eventsData, user] = await Promise.all([
workflowCaller.getVerifiedEmails({ teamId }),
teamId ? workflowCaller.getVerifiedNumbers({ teamId }) : Promise.resolve([]),
eventCaller.getTeamAndEventTypeOptions({ teamId, isOrg }),
userCaller.get(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@github-actions github-actions bot marked this pull request as draft June 29, 2025 07:23
@github-actions github-actions bot removed the Stale label Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Created by Linear-GitHub Sync community-interns The team responsible for reviewing, testing and shipping low/medium community PRs performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive ready-for-e2e workflows area: workflows, automations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants