Skip to content

perf: Remove data fetching in metadata for non-booking pages #20734

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

Merged
merged 6 commits into from
Apr 26, 2025

Conversation

hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Apr 16, 2025

What does this PR do?

  • A server call for generating metadata is too much. We can use simple static metadata (not fully static because we need to fetch t function for i18n)
  • Good news—we do data fetching for metadata only in 2 non-booking pages (/workflows/[workflow] and /apps/installation)

Before OG image

15-minute Reminder is the name of the workflow

Screenshot 2025-04-16 at 3 28 01 PM

After OG image

Screenshot 2025-04-16 at 3 28 58 PM

/workflows/[id] page now has this metadata:

Screenshot 2025-04-16 at 3 31 34 PM

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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Test /workflows and /workflows/[id]

Copy link

vercel bot commented Apr 16, 2025

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 Apr 26, 2025 0:16am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Apr 26, 2025 0:16am

@graphite-app graphite-app bot requested a review from a team April 16, 2025 19:23
@keithwillcode keithwillcode added core area: core, team members only foundation labels Apr 16, 2025
@dosubot dosubot bot added performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive workflows area: workflows, automations labels Apr 16, 2025
if (!parsed.success) {
notFound();
}
const workflow = await getWorkflow(parsed.data.workflow);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Data fetching for metadata isn't optimal. Below is enough.

await _generateMetadata(
    (t) => t("workflows"),
    (t) => t("workflows_to_automate_notifications")
  );

@hbjORbj hbjORbj changed the title perf: simplify metadata for workflows perf: workflows—remove data fetching for metadata Apr 16, 2025
Copy link

graphite-app bot commented Apr 16, 2025

Graphite Automations

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

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

@hbjORbj hbjORbj enabled auto-merge (squash) April 16, 2025 19:25
@hbjORbj hbjORbj disabled auto-merge April 16, 2025 19:25
@hbjORbj hbjORbj enabled auto-merge (squash) April 16, 2025 19:26
import { _generateMetadata } from "app/_utils";
import type { ReactNode } from "react";

export const generateMetadata = async () =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is now used for both /workflows and /workflows/[workflow] page

Copy link
Contributor

github-actions bot commented Apr 16, 2025

E2E results are ready!

@hbjORbj hbjORbj changed the title perf: workflows—remove data fetching for metadata perf: Remove data fetching for metadata for non-booking pages Apr 16, 2025
@hbjORbj hbjORbj changed the title perf: Remove data fetching for metadata for non-booking pages perf: Remove data fetching in metadata for non-booking pages Apr 16, 2025
export const generateMetadata = async ({ params, searchParams }: PageProps) => {
const legacyCtx = buildLegacyCtx(await headers(), await cookies(), await params, await searchParams);

const { appMetadata } = await getData(legacyCtx);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Data fetching

@@ -23,7 +23,6 @@ const normalizePages = (pages: string[] | string | undefined) => {
export const generateMetadata = async ({ params }: { params: Promise<{ pages: string[] }> }) => {
const { mainPage } = normalizePages((await params).pages);
return await _generateMetadata(
// TODO: Need to show the actual form name instead of "Form"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, keeping it the current way is better

zomars
zomars previously approved these changes Apr 18, 2025
@hbjORbj
Copy link
Contributor Author

hbjORbj commented Apr 21, 2025

@zomars Had to resolve conflicts. Can you re-approve? 🙏

@hbjORbj hbjORbj merged commit 57df255 into main Apr 26, 2025
35 of 37 checks passed
@hbjORbj hbjORbj deleted the perf/simplify-metadata-for-workflows branch April 26, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only foundation 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.

4 participants