fix(fe): external link dialog open model

This commit is contained in:
andrewwallacespeckle
2025-07-21 16:11:37 +01:00
parent 67bd1341aa
commit 49a0b2ec6e
2 changed files with 9 additions and 2 deletions
@@ -1,5 +1,5 @@
<template>
<LayoutDialog v-model:open="state.open" max-width="xs" :buttons="buttons">
<LayoutDialog v-model:open="open" max-width="xs" :buttons="buttons">
<template #header>Leaving Speckle</template>
<p class="mb-2">You're about to open the link below in a new tab:</p>
<div class="p-3 bg-highlight-2 rounded-md font-mono break-all">
@@ -21,6 +21,7 @@ const { state, close } = useExternalLinkDialogState()
const buttons = computed((): LayoutDialogButton[] => [
{
text: 'Cancel',
props: { color: 'subtle' },
onClick: () => {
close(false)
}
@@ -34,4 +35,11 @@ const buttons = computed((): LayoutDialogButton[] => [
}
}
])
const open = computed({
get: () => state.value.open,
set: (v) => {
if (!v) close(false)
}
})
</script>
@@ -4,7 +4,6 @@ type ExternalLinkState = {
_resolver?: (accepted: boolean) => void
}
// helper so useState is called lazily in a valid context
const useSharedExternalLinkState = () =>
useState<ExternalLinkState>('global_external_link', () => ({
open: false,