Skip to content
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

[UI v2] feat: Updates loader for concurrency limit route to include active task runs logic #16522

Merged
merged 5 commits into from
Jan 2, 2025

Conversation

devinvillarosa
Copy link
Contributor

@devinvillarosa devinvillarosa commented Dec 27, 2024

  1. Updates loader and data for concurrency limit route such that it includes the parent flow run and flow details. This is so it prefectches data to populate the upcoming active task runs UI

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

Relates to #15512

@github-actions github-actions bot added the ui-replatform Related to the React UI rewrite label Dec 27, 2024
@devinvillarosa devinvillarosa force-pushed the task-run-concurrency-limit-loader-update branch 3 times, most recently from 66ac5e7 to 47333a6 Compare December 27, 2024 16:15
@devinvillarosa devinvillarosa marked this pull request as ready for review December 27, 2024 16:16
active_slots: ["task_0"],
});

const MOCK_TASK_RUNS: Array<components["schemas"]["TaskRun"]> = [
Copy link
Member

Choose a reason for hiding this comment

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

Do you think you could use some of the mock generators in this test to decrease the verbosity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya, I think we might be able to centralize some of these mocks to use faker (with options to ovrrride), similar to how some storybook stories does it.

Just need to centralize them in a place so its known to be re-used between storybook and vitest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated latest push to:

  1. Centralize mocks using faker/js so they can be used between Storybook and Vitest
  2. Replaces verbose mocks for mocks above

* @param id
* @returns query options for a task-run concurrency limit with active run details that includes details on task run, flow run, and flow
*/
export const buildConcurrenyLimitDetailsActiveRunsQuery = (id: string) =>
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this is hitting our long-standing challenge of n+1 requests to the API. This handles the challenge well, but I'm a little concerned that all these calls are contained in one query, which is then used to suspend rendering until they've all been resolved.

There are a couple of things I'd like to explore:

  1. Breaking these calls into separate queries and only suspending rendering for critical data (like the concurrency limit info). We can also investigate using deferred loading with @tanstack/router to continue using data loaders without blocking rendering.
  2. Update the task run routes to include the flow run name to avoid needing to make another call for the flow runs filter route. I don't know how feasible this is since we'll need to take DB performance into account.

I'll do some exploration in the deployments list, but let's make sure we compare notes because we'll want a consistent approach to this in the application!

Copy link
Contributor Author

@devinvillarosa devinvillarosa Dec 27, 2024

Choose a reason for hiding this comment

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

Sounds good. I can do some more exploration as well.

I opted for this route because the prefetching and loading mechanism comes out of the box. Also, it seems like this is more data critical stuff too

This way seems to give a faster UX because the data is loaded upon hovering over the Links

Copy link
Contributor Author

@devinvillarosa devinvillarosa Dec 27, 2024

Choose a reason for hiding this comment

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

I think this video is a good explanation on the different options to sync data to the client: https://www.youtube.com/watch?v=AuHqwQsf64o&t=566s

Just need to determine how critical our data really is

Screenshot 2024-12-27 at 2 55 28 PM

Copy link
Contributor Author

@devinvillarosa devinvillarosa Dec 28, 2024

Choose a reason for hiding this comment

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

Latest push uses the await/defer approach. I do see a bit better UX performance, but it feels minimal compared to throwing it all in useSuspense

@devinvillarosa devinvillarosa force-pushed the task-run-concurrency-limit-loader-update branch 8 times, most recently from 230935e to d1d71ba Compare December 29, 2024 02:22
@devinvillarosa devinvillarosa force-pushed the task-run-concurrency-limit-loader-update branch 4 times, most recently from f281e5f to 6f6f193 Compare January 2, 2025 18:50
@devinvillarosa devinvillarosa force-pushed the task-run-concurrency-limit-loader-update branch from 6f6f193 to 6b27c63 Compare January 2, 2025 19:37
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

This looks really great! Thanks for the exploration and finding the right levers to pull to balance fetching critical data vs. not blocking rending!

@devinvillarosa devinvillarosa force-pushed the task-run-concurrency-limit-loader-update branch from 6b27c63 to fb12e3e Compare January 2, 2025 23:01
@devinvillarosa devinvillarosa force-pushed the task-run-concurrency-limit-loader-update branch from fb12e3e to abd8814 Compare January 2, 2025 23:18
@devinvillarosa devinvillarosa merged commit 74adb9f into main Jan 2, 2025
8 checks passed
@devinvillarosa devinvillarosa deleted the task-run-concurrency-limit-loader-update branch January 2, 2025 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui-replatform Related to the React UI rewrite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants