From 1cefd488fe40cd1ebcec44acc45e97acbf3cf6e9 Mon Sep 17 00:00:00 2001 From: Elias Meire Date: Fri, 31 May 2024 15:07:49 +0200 Subject: [PATCH] refactor(editor): Fix TypeScript issues in template code (no-changelog) (#9574) --- .../editor-ui/src/components/TemplateCard.vue | 16 +++++--- .../src/components/TemplateDetails.vue | 40 ++++++++++++++----- .../editor-ui/src/components/TemplateList.vue | 9 +++-- .../src/components/TemplatesInfoCard.vue | 10 +++-- .../src/components/TemplatesInfoCarousel.vue | 3 +- .../src/components/WorkflowPreview.vue | 4 +- packages/editor-ui/src/shims.d.ts | 1 + .../src/utils/templates/typeGuards.ts | 17 ++++++++ .../src/views/TemplatesCollectionView.vue | 27 +++++++------ .../src/views/TemplatesSearchView.vue | 5 ++- .../src/views/TemplatesWorkflowView.vue | 6 +-- 11 files changed, 94 insertions(+), 44 deletions(-) create mode 100644 packages/editor-ui/src/utils/templates/typeGuards.ts diff --git a/packages/editor-ui/src/components/TemplateCard.vue b/packages/editor-ui/src/components/TemplateCard.vue index 1eab5bc6a9..759d3a2550 100644 --- a/packages/editor-ui/src/components/TemplateCard.vue +++ b/packages/editor-ui/src/components/TemplateCard.vue @@ -12,7 +12,7 @@
-
+
{{ workflow.name }}
@@ -31,7 +31,10 @@ >
-
+
@@ -47,11 +50,12 @@ diff --git a/packages/editor-ui/src/components/TemplateList.vue b/packages/editor-ui/src/components/TemplateList.vue index fe9a6012ce..6207345293 100644 --- a/packages/editor-ui/src/components/TemplateList.vue +++ b/packages/editor-ui/src/components/TemplateList.vue @@ -34,8 +34,9 @@ diff --git a/packages/editor-ui/src/views/TemplatesSearchView.vue b/packages/editor-ui/src/views/TemplatesSearchView.vue index 8e0a5b77f8..55cfdcf37c 100644 --- a/packages/editor-ui/src/views/TemplatesSearchView.vue +++ b/packages/editor-ui/src/views/TemplatesSearchView.vue @@ -198,8 +198,9 @@ export default defineComponent({ setTimeout(() => { // Check if there is scroll position saved in route and scroll to it - if (this.$route.meta && this.$route.meta.scrollOffset > 0) { - this.scrollTo(this.$route.meta.scrollOffset, 'auto'); + const scrollOffset = this.$route.meta?.scrollOffset; + if (typeof scrollOffset === 'number' && scrollOffset > 0) { + this.scrollTo(scrollOffset, 'auto'); } }, 100); }, diff --git a/packages/editor-ui/src/views/TemplatesWorkflowView.vue b/packages/editor-ui/src/views/TemplatesWorkflowView.vue index d66a81c75a..fa582f3b95 100644 --- a/packages/editor-ui/src/views/TemplatesWorkflowView.vue +++ b/packages/editor-ui/src/views/TemplatesWorkflowView.vue @@ -31,15 +31,15 @@