Skip to content

Commit

Permalink
avoids watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Feb 4, 2024
1 parent 4ed508f commit 86a8704
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/dye/components/DyePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Colord } from 'colord'
import { vOnClickOutside } from '@vueuse/components'
import { umbra } from '@umbrajs/core'
import { ref, watch } from 'vue'
import { ref, onMounted } from 'vue'
import { colorName } from '../composables/colorName'
import { hexType, useColorCanvas } from '../composables/canvas'
import Pallet from './Pallet.vue'
Expand Down Expand Up @@ -41,10 +41,10 @@ const color = ref({
value: props.default
})
watch(color, (c) => {
onMounted(() => {
if (!pickerRef.value) return
umbra({
background: c.value
background: color.value.value
}).apply({ target: pickerRef.value })
})
Expand All @@ -54,6 +54,11 @@ function handleChange(hex?: hexType, mounted = false) {
color.value = { name, value }
if (mounted) return
umbra({
background: color.value.value
}).apply({ target: pickerRef.value })
emit('change', {
name,
value: colord(value),
Expand Down

0 comments on commit 86a8704

Please sign in to comment.