From 522efd4c94cb4b5f362af0777085d7d9c41b2e82 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 1 Feb 2023 21:16:41 +0100 Subject: [PATCH] refactor(core): throw warning if dimensions of viewport are 0 Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/core/src/container/Viewport/Viewport.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/container/Viewport/Viewport.vue b/packages/core/src/container/Viewport/Viewport.vue index 69bfdb6a..38526ee0 100644 --- a/packages/core/src/container/Viewport/Viewport.vue +++ b/packages/core/src/container/Viewport/Viewport.vue @@ -72,8 +72,11 @@ const setDimensions = () => { if (!viewportEl.value) return const { width, height } = getDimensions(viewportEl.value) - dimensions.width = width - dimensions.height = height + + if (width === 0 || height === 0) warn('The Vue Flow parent container needs a width and a height to render the graph.') + + dimensions.width = width || 500 + dimensions.height = height || 500 } const isWrappedWithClass = (event: Event, className: string | undefined) => (event.target as Element).closest(`.${className}`)