Skip to content

Commit

Permalink
Refactor workflowID handling
Browse files Browse the repository at this point in the history
To use undefined instead of an empty string and improve conditional checks
  • Loading branch information
davelopez committed Jan 31, 2025
1 parent cc26ff9 commit f77d4c6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/src/components/Markdown/Markdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default {
workflows: {},
invocations: {},
loading: true,
workflowID: "",
workflowID: undefined,
};
},
computed: {
Expand Down Expand Up @@ -159,7 +159,7 @@ export default {
return "unavailable";
},
workflowVersions() {
return this.getStoredWorkflowByInstanceId(this.workflowID);
return this.workflowID ? this.getStoredWorkflowByInstanceId(this.workflowID) : undefined;
},
version() {
return this.markdownConfig.generate_version || "Unknown Galaxy Version";
Expand All @@ -172,7 +172,9 @@ export default {
},
created() {
this.initConfig();
this.fetchWorkflowForInstanceId(this.workflowID);
if (this.workflowID) {
this.fetchWorkflowForInstanceId(this.workflowID);
}
},
methods: {
...mapActions(useWorkflowStore, ["getStoredWorkflowByInstanceId", "fetchWorkflowForInstanceId"]),
Expand All @@ -188,7 +190,7 @@ export default {
this.workflows = config.workflows || {};
this.invocations = config.invocations || {};
this.loading = false;
this.workflowID = Object.keys(this.markdownConfig?.workflows ?? {})[0] ?? "";
this.workflowID = Object.keys(this.markdownConfig?.workflows ?? {})[0];
}
},
splitMarkdown(markdown) {
Expand Down

0 comments on commit f77d4c6

Please sign in to comment.