Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 16ae0bd

Browse files
authored
Merge pull request #130 from alvarosaburido/bugfix/cannot-destructure-property-customcl
fix(options): added condition for empty options
2 parents 36fea2b + e13bada commit 16ae0bd

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22
on:
3-
pull_request:
3+
pull_request:
44
branches:
55
- main
66
- next

src/components/dynamic-form/DynamicForm.vue

+18-14
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ import DynamicInput from '../dynamic-input/DynamicInput.vue';
5151
5252
import { InputBase, FormControl } from '../../core/models';
5353
import { dynamicFormsSymbol } from '../../useApi';
54-
import { warn } from '../../core/utils/warning';
55-
54+
/* import { warn } from '../../core/utils/warning';
55+
*/
5656
const props = {
5757
form: {
5858
type: Object as PropType<DynamicForm>,
@@ -64,8 +64,8 @@ const components = {
6464
DynamicInput,
6565
};
6666
67-
const AVAILABLE_THEMES = ['default', 'material'];
68-
67+
/* const AVAILABLE_THEMES = ['default', 'material'];
68+
*/
6969
export default defineComponent({
7070
name: 'asDynamicForm',
7171
props,
@@ -130,16 +130,20 @@ export default defineComponent({
130130
});
131131
132132
const formattedOptions = computed(() => {
133-
const { customClass, method, netlify, netlifyHoneypot } = options.form;
134-
return {
135-
class: [
136-
customClass,
137-
/* validTheme.value ? `theme-${options.theme}` : null, */
138-
].join(' '),
139-
method,
140-
'data-netlify': netlify,
141-
'data-netlify-honeypot': netlifyHoneypot,
142-
};
133+
if (options?.form) {
134+
const { customClass, method, netlify, netlifyHoneypot } = options?.form;
135+
return {
136+
class: [
137+
customClass,
138+
/* validTheme.value ? `theme-${options.theme}` : null, */
139+
].join(' '),
140+
method,
141+
'data-netlify': netlify,
142+
'data-netlify-honeypot': netlifyHoneypot,
143+
};
144+
} else {
145+
return;
146+
}
143147
});
144148
145149
function valueChange(changedValue: any) {

src/components/dynamic-input/DynamicInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default defineComponent({
6666
});
6767
6868
const autoValidate = computed(
69-
() => props?.control?.touched && options.autoValidate,
69+
() => props?.control?.touched && options?.autoValidate,
7070
);
7171
7272
const showErrors = computed(() => {

0 commit comments

Comments
 (0)