Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
thworing error on failed model validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Sieder committed Jan 15, 2021
1 parent 0f2c9c3 commit 1b4789e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ News Priority:
-->

## 0.1.28 (2020-12-11)
### Breaking Changes
- Throwing an error if the passed down model is invalid.

## 0.1.27 (2020-12-11)
### Improvements
- Changed `rem` to `em` as it's better stylable this way.
Expand Down
6 changes: 6 additions & 0 deletions src/components/VueAutosearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ export default defineComponent({
watch(searchTerm, filterAction, { immediate: true });
watch(options, filterAction, { immediate: true });
watch(modelValue, () => {
if (modelValue.value !== null && (!modelValue.value.id || !modelValue.value.name)) {
throw new Error(`Missing model props for ${modelValue.value}`);
}
});
const resetSearch = () => {
if (modelValue.value === null) {
searchTerm.value = "";
Expand Down

0 comments on commit 1b4789e

Please sign in to comment.