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.
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
base: main
Are you sure you want to change the base?
perf: fetch server side data for workflow details page #20778
Changes from all commits
32fde0b
4f1b698
87a241e
b189e51
fbae058
9ceafca
e2eb382
7663a7f
62da080
efcd593
2ca0c44
6dc25e0
1ffde98
dc7f475
c15e43f
38651fe
30f93d8
af4424e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: what happens when
teamId
is undefined? does it break anything? if so, shouldn't we show 404 page?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case it returns
[] - empty array
same as what we have as fallback rn , nothing's breakingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can improve it by skipping the verifiedNumbers call if teamId is undefined and
return [] straight away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why this change was necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for better readability/code quality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query should stay client-side because the "Add action" Dialog should not block the initial load. For example, imagine that the query fetching for Add Action Dialog failed. Now it blocks the entire page load. Handling a query failure is another topic, but I am mentioning it to help you decide which is something you should fetch server-side vs client-side. The more server-side fetching we do, the slower the initial load is, and hence we should determine carefully which queries to turn to server-side and keep client-side.
So, Please think about this for other queries you switched to server-side in this PR and make changes accordingly!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically we where doing this same call two times :
one for the page (form)
andanother for this Dialog
so I just removed it from here and passed from the page - I understand your concerns but that's not the case hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you understood my point. I am saying we should not have
workflowCaller.getWorkflowActionOptions()
in RSC.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean - we should call
getWorkflowActionOptions
client side and pass to this modal as well (as we are already doing in this PR) , sounds good btwThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply let
const { data: actionOptions } = trpc.viewer.workflows.getWorkflowActionOptions.useQuery();
just stay inpackages/features/ee/workflows/components/AddActionDialog.tsx
unless you have a better optimization in mind.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we'll end up doing two calls for actionOptions as soon as the page renders (current behaviour on prod) - one in
WorkflowDetailsPage.tsx
and another inAddActionDialog.tsx
(we require this data on both places)I have updated it to call just once just inside
WorkflowDetailsPage
and simply pass it toAddActionDialog
as propThoughts ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good but is it necessary? Client-side trpc queries are cached, no? especially since these two queries happen almost at the same time?
I love to avoid prop drilling as much as possible unless it's necessary
Would be great to have you test this quickly 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API calls increases making them look lot more - having one looked clean to me , anyways I have added an trpc call in the Dialog as well