-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
TusharBhatt1
wants to merge
24
commits into
calcom:main
Choose a base branch
from
TusharBhatt1:perf/fetch-server-side-data-for-dynamic-webflow-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
32fde0b
perf:fetch-server-side-data-for-dynamic-webflow-page
TusharBhatt1 4f1b698
skeleton
TusharBhatt1 87a241e
suggested-changes
TusharBhatt1 b189e51
type check
TusharBhatt1 fbae058
skeleton
TusharBhatt1 9ceafca
type-check
TusharBhatt1 e2eb382
dynamic shell name
TusharBhatt1 7663a7f
type-check
TusharBhatt1 62da080
type-check
TusharBhatt1 efcd593
one more call to ss
TusharBhatt1 2ca0c44
Merge branch 'calcom:main' into perf/fetch-server-side-data-for-dynam…
TusharBhatt1 6dc25e0
skeleton
TusharBhatt1 1ffde98
Merge branch 'perf/fetch-server-side-data-for-dynamic-webflow-page' o…
TusharBhatt1 dc7f475
Merge branch 'main' into perf/fetch-server-side-data-for-dynamic-webf…
hbjORbj c15e43f
optimie queries
TusharBhatt1 38651fe
moved actionOptions call back to client side
TusharBhatt1 30f93d8
Merge branch 'perf/fetch-server-side-data-for-dynamic-webflow-page' o…
TusharBhatt1 af4424e
final-change
TusharBhatt1 76b65aa
fix: ts error
TusharBhatt1 1014bf1
Merge branch 'main' into perf/fetch-server-side-data-for-dynamic-webf…
TusharBhatt1 9998a15
adding revalidate and cache
TusharBhatt1 e390d98
Merge branch 'main' into perf/fetch-server-side-data-for-dynamic-webf…
TusharBhatt1 49b5bfe
Merge branch 'perf/fetch-server-side-data-for-dynamic-webflow-page' o…
TusharBhatt1 cb04804
indentation
TusharBhatt1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
"use server"; | ||
|
||
import { revalidateTag, unstable_cache } from "next/cache"; | ||
|
||
import { NEXTJS_CACHE_TTL } from "@calcom/lib/constants"; | ||
import { UserRepository } from "@calcom/lib/server/repository/user"; | ||
import { WorkflowRepository } from "@calcom/lib/server/repository/workflow"; | ||
|
||
const CACHE_TAGS = { | ||
WORKFLOWS_LIST: "WorkflowRepository.filteredList", | ||
WORKFLOW_BY_ID: "WorkflowRepository.getById", | ||
VERIFIED_NUMBERS: "WorkflowRepository.getVerifiedNumbers", | ||
VERIFIED_EMAILS: "WorkflowRepository.getVerifiedEmails", | ||
ENRICHED_USER: "UserRepository.enrichUserWithTheProfile", | ||
} as const; | ||
|
||
export const getCachedWorkflowsFilteredList = unstable_cache( | ||
async (userId: number, filters: any) => { | ||
return await WorkflowRepository.getFilteredList({ userId, input: { filters } }); | ||
}, | ||
["getCachedWorkflowsFilteredList"], | ||
{ | ||
revalidate: NEXTJS_CACHE_TTL, | ||
tags: [CACHE_TAGS.WORKFLOWS_LIST], | ||
} | ||
); | ||
|
||
export async function revalidateWorkflowsList() { | ||
revalidateTag(CACHE_TAGS.WORKFLOWS_LIST); | ||
} | ||
|
||
export const getCachedWorkflowById = unstable_cache( | ||
async (id: number) => { | ||
return await WorkflowRepository.getById({ id }); | ||
}, | ||
["getCachedWorkflowById"], | ||
{ | ||
revalidate: NEXTJS_CACHE_TTL, | ||
tags: [CACHE_TAGS.WORKFLOW_BY_ID], | ||
} | ||
); | ||
|
||
export const getCachedWorkflowVerifiedNumber = unstable_cache( | ||
async (teamId: number, userId: number) => { | ||
return await WorkflowRepository.getVerifiedNumbers({ teamId, userId }); | ||
}, | ||
["getCachedWorkflowVerifiedNumber"], | ||
{ | ||
revalidate: NEXTJS_CACHE_TTL, | ||
tags: [CACHE_TAGS.VERIFIED_NUMBERS], | ||
} | ||
); | ||
export const getCachedWorkflowVerifiedEmails = unstable_cache( | ||
async (userEmail: string, userId: number, teamId?: number) => { | ||
return await WorkflowRepository.getVerifiedEmails({ userEmail, userId, teamId }); | ||
}, | ||
["getCachedWorkflowVerifiedEmails"], | ||
{ | ||
revalidate: NEXTJS_CACHE_TTL, | ||
tags: [CACHE_TAGS.VERIFIED_EMAILS], | ||
} | ||
); | ||
|
||
export const getCachedUser = unstable_cache( | ||
async (user: any, upId: string) => { | ||
return await UserRepository.enrichUserWithTheProfile({ user, upId }); | ||
}, | ||
["getCachedUser"], | ||
{ | ||
revalidate: NEXTJS_CACHE_TTL, | ||
tags: [CACHE_TAGS.ENRICHED_USER], | ||
} | ||
); | ||
|
||
export async function revalidateWorkflowById() { | ||
revalidateTag(CACHE_TAGS.WORKFLOW_BY_ID); | ||
} | ||
export async function revalidateWorkflowVerifiedNumbers() { | ||
revalidateTag(CACHE_TAGS.VERIFIED_NUMBERS); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/features/ee/workflows/components/WorkFlowFormSkeleton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { SkeletonText } from "@calcom/ui/components/skeleton"; | ||
|
||
export default function WorkFlowFormSkeleton() { | ||
return ( | ||
<div className="min-w-80 bg-default border-subtle w-full space-y-6 rounded-md border p-7"> | ||
<div className="flex items-center gap-4"> | ||
<SkeletonText className="w-6 rounded-full" /> | ||
<div className="flex w-full flex-col gap-2"> | ||
<SkeletonText className="w-28" /> | ||
<SkeletonText className="w-40" /> | ||
</div> | ||
</div> | ||
<div className="border-subtle border-t" /> | ||
{Array.from({ length: 2 }).map((_, idx) => ( | ||
<div key={idx} className="space-y-2"> | ||
<SkeletonText className="w-28" /> | ||
<SkeletonText className="w-full" /> | ||
</div> | ||
))} | ||
<SkeletonText className="w-full" /> | ||
</div> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.