diff --git a/docs/components/home/Features.vue b/docs/components/home/Features.vue index 1070b34a..dd9897e0 100644 --- a/docs/components/home/Features.vue +++ b/docs/components/home/Features.vue @@ -4,6 +4,7 @@ import type { VueFlowStore } from '@braks/vue-flow' const breakpoints = useBreakpoints(breakpointsTailwind) +const el = ref() const instances: VueFlowStore[] = [] const onLoad = (instance: VueFlowStore) => { @@ -15,13 +16,15 @@ const fitViews = () => { instances.forEach((i) => i.fitView()) } -watchDebounced([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], () => fitViews(), { - debounce: 50, -}) +const { stop } = useResizeObserver( + el, + useDebounceFn(() => fitViews(), 5), +) +onBeforeUnmount(stop)