Skip to content

Commit

Permalink
fix(KvCheckbox, KvRadio, KvSwitch): Avoid SSR problems when setting t…
Browse files Browse the repository at this point in the history
…he UUID
  • Loading branch information
ryan-ludwig committed Sep 30, 2021
1 parent 597410f commit 16f1cb8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion @kiva/kv-components/vue/KvCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default {
},
data() {
return {
uuid: `kvc-${nanoid(10)}`,
uuid: '',
isChecked: false,
};
},
Expand All @@ -119,6 +119,9 @@ export default {
created() {
this.setChecked();
},
mounted() {
this.uuid = `kvc-${nanoid(10)}`;
},
methods: {
onChange(event) {
// get the input[type=checkbox] state
Expand Down
5 changes: 4 additions & 1 deletion @kiva/kv-components/vue/KvRadio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default {
},
data() {
return {
uuid: `kvr-${nanoid(10)}`,
uuid: '',
};
},
computed: {
Expand All @@ -146,6 +146,9 @@ export default {
};
},
},
mounted() {
this.uuid = `kvr-${nanoid(10)}`;
},
methods: {
onChange(event) {
/**
Expand Down
5 changes: 4 additions & 1 deletion @kiva/kv-components/vue/KvSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {
},
data() {
return {
uuid: `kvs-${nanoid(10)}`,
uuid: '',
};
},
computed: {
Expand All @@ -104,6 +104,9 @@ export default {
};
},
},
mounted() {
this.uuid = `kvs-${nanoid(10)}`;
},
methods: {
onChange(event) {
this.$emit('change', event.target.checked);
Expand Down

0 comments on commit 16f1cb8

Please sign in to comment.