docs: use debounce for fitviews

This commit is contained in:
bcakmakoglu
2022-06-06 22:11:19 +02:00
committed by Braks
parent 87f97efd42
commit ac41c0093e

View File

@@ -1,5 +1,4 @@
<script lang="ts" setup>
import { watch } from 'vue'
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
import type { VueFlowStore } from '@braks/vue-flow'
@@ -16,11 +15,9 @@ const fitViews = () => {
instances.forEach((i) => i.fitView())
}
watch([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], () =>
setTimeout(() => {
fitViews()
}, 5),
)
watchDebounced([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], () => fitViews(), {
debounce: 50,
})
</script>
<template>