Skip to content

Commit 134697a

Browse files
committed
fix(TresLeches): update controls handling to ensure reactive access and expose controls correctly
1 parent 031682b commit 134697a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/leches/src/components/TresLeches.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,19 @@ const panelWidth = ref(DEFAULT_WIDTH)
4949
const resizeEdge = ref<'right' | 'left' | 'bottom' | 'corner' | 'corner-left' | null>(null)
5050
5151
// Controls
52-
const controls = useControlsProvider(uuid?.value)
52+
useControlsProvider(uuid?.value)
5353
const hasSlots = ref(false)
5454
const { store: controlsStore, triggers: controlsTriggers } = useControlsStore()
5555
56-
defineExpose(controls)
56+
// Reactive getter — controlsStore[uuid] may not exist yet when TresLeches
57+
// mounts before child components register their controls via useControls()
58+
const controls = computed(() => controlsStore[uuid.value] || {})
59+
60+
defineExpose({ controls })
5761
5862
function onChange(key: string, value: string) {
59-
const control = controls[key] as any
63+
const control = controls.value[key] as any
64+
if (!control) { return }
6065
// Update the ref (control.value is a ref)
6166
if (isRef(control.value)) {
6267
control.value.value = value

0 commit comments

Comments
 (0)