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

fix: only filter NodeExecutions when viewing the Nodes tab #88

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

schottra
Copy link
Contributor

flyteorg/flyte#425

We share the loaded NodeExecutions between the two tabs on the ExecutionDetails page.
This is a useful performance optimization when both are viewing an unfiltered list of NodeExecutions. But it results in missing node information when a filter is applied in the Nodes tab and then the Graph tab is opened.

To address this, I updated the logic in ExecutionNodeViews to only pass the filter list if the current tab is the Nodes tab. This has the effect of resetting the fetchable for NodeExecutions when the tab is changed if a filter is applied. But if no filter is applied, the passed list will be empty in all cases, resulting in reuse of the previously-fetched data.

The majority of this PR is actually cleanup work done to facilitate writing a unit test to cover the new behavior 😁

Copy link

@podehnal podehnal left a comment

Choose a reason for hiding this comment

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

👍

@@ -1,7 +1,7 @@
import { useState } from 'react';

export function useTabState(
tabs: { [k: string]: string },
tabs: { [k: string]: string | object },
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we type this?

Suggested change
tabs: { [k: string]: string | object },
tabs: { [k: string]: string | { id: string; label: string } },

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. At the moment, the shape of the object doesn't matter. So I'm okay leaving it generic.

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2020

Codecov Report

Merging #88 into master will increase coverage by 2.36%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   63.86%   66.22%   +2.36%     
==========================================
  Files         366      367       +1     
  Lines        5856     5860       +4     
  Branches      892      893       +1     
==========================================
+ Hits         3740     3881     +141     
+ Misses       2116     1979     -137     
Impacted Files Coverage Δ
src/components/hooks/useTabState.ts 100.00% <ø> (ø)
...Executions/ExecutionDetails/ExecutionNodeViews.tsx 100.00% <100.00%> (+40.00%) ⬆️
...omponents/Executions/ExecutionDetails/constants.ts 100.00% <100.00%> (ø)
src/components/Executions/filters/constants.ts 100.00% <100.00%> (ø)
...nts/Executions/filters/useExecutionFiltersState.ts 94.11% <100.00%> (+31.61%) ⬆️
src/components/Executions/useExecutionDataCache.ts 78.04% <0.00%> (+1.21%) ⬆️
src/components/hooks/useFetchableData.ts 93.15% <0.00%> (+1.36%) ⬆️
src/components/hooks/useNodeExecutions.ts 80.95% <0.00%> (+33.33%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 508357d...83a2267. Read the comment docs.

@service-github-lyft-semantic-release
Copy link
Contributor

🎉 This PR is included in version 0.8.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@schottra schottra deleted the fix-execution-tab-data branch September 9, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants