Skip to content

Commit

Permalink
update hubspot forms
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantgillespie committed Oct 31, 2024
1 parent 8bd1a4a commit 4009c04
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions components/Base/HsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface BaseHsFormProps {
inline?: boolean;
align?: 'left' | 'center';
routeToMeetingLinkOnSuccess?: boolean;
instanceId?: string;
}
const props = withDefaults(defineProps<BaseHsFormProps>(), {
Expand All @@ -13,6 +14,11 @@ const props = withDefaults(defineProps<BaseHsFormProps>(), {
align: 'center',
});
// Nuxt Scripts help prevent the script from being loaded multiple times
const { onLoaded } = useScript({
src: 'https://js.hsforms.net/forms/embed/v2.js',
});
const { formId } = toRefs(props);
const { $directus, $readSingleton, $posthog } = useNuxtApp();
Expand Down Expand Up @@ -78,22 +84,16 @@ const renderHsForm = () => {
});
};
useHead({
script: [
{
src: 'https://js.hsforms.net/forms/embed/v2.js',
defer: true,
onload: renderHsForm,
},
],
});
const generatedId = computed(() => `hs-form-${unref(formId)}`);
const generatedId = computed(() => `hs-form-${unref(formId)}${props.instanceId ? `-${props.instanceId}` : ''}`);
const { theme } = useTheme();
onMounted(renderHsForm);
onUpdated(renderHsForm);
onLoaded(renderHsForm);
// @TODO: Not sure why we had these here. Safe to remove?
// onMounted(renderHsForm);
// onUpdated(renderHsForm);
watch(formId, renderHsForm);
</script>

Expand Down

0 comments on commit 4009c04

Please sign in to comment.