Render DAGCode in the Grid View as a tab#31113
Conversation
bbovenzi
left a comment
There was a problem hiding this comment.
Looking good!
Few comments:
- Let's move the API logic to react-query and then add some basic handling for loading+error states
- Maybe bump the font-size down? It's quite a bit larger than the rest of the grid view text
I have reduced the font size to 13.5px. Please have a look and let me know if it looks OK. |
bbovenzi
left a comment
There was a problem hiding this comment.
Looking better! Left a few suggestions.
bbovenzi
left a comment
There was a problem hiding this comment.
I added a commit to clean up our API requests. react-query is really cool, it handles most of this logic for us so we don't need to manage loading, errors, or any state and effects ourselves.
A general rule, if you're updating state inside of useEffect you're probably doing something wrong. I catch myself doing that too.
|
Hi, when the user modify the DAG code, is there a way refetch of the new updated code without performing a page refresh? The question arise when I'm working on implementing the XCom tab in grid view (issue) - which suffers from the same behaviour of not refetching when say a new run occurs and XCom changes. Thoughts on either a button to refetch or refetch on mount? |
|
I would prefer to keep it to a page refetch since changing the DAG code because we're reparsing the dag and those changes could affect any number of ways we render the entire DAG page. In your PR, isn't an xcom connected to a specific dag run so selecting a new run would then cause another request to the API? |
|
I made this comment before I fully completed my XCom tab PR. So, I agree that probably best to keep the page refresh for DAG code as there isn't a good "event" that we can use as trigger for code refresh. Originally in my PR, I had a problem where a new try on the same run occurred (e.g., the XCom producing task is cleared) and XCom is not refetched unless the page refreshes. I fixed this by including the tryNumber in the react query key. |
closes: #29858
Using REST API to render DAG Code in the grid view as a tab when a user has no tasks selected.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.