fix the user watcher

This commit is contained in:
Andreas Zweili 2021-09-04 16:49:18 +02:00
parent 2cc7c3a99c
commit c395d863f1
1 changed files with 6 additions and 2 deletions

View File

@ -21,7 +21,7 @@
</template> </template>
<script> <script>
import { ref, computed, watch } from 'vue'; import { ref, computed, watch, toRefs } from 'vue';
import ProjectItem from './ProjectItem.vue'; import ProjectItem from './ProjectItem.vue';
export default { export default {
@ -46,6 +46,10 @@ export default {
return props.user.projects && availableProjects.value.length > 0; return props.user.projects && availableProjects.value.length > 0;
}); });
//const propsWithRefs = toRefs(props);
//const user = propsWithRefs.user;
const { user } = toRefs(props);
watch(enteredSearchTerm, function(newValue) { watch(enteredSearchTerm, function(newValue) {
setTimeout(() => { setTimeout(() => {
if (newValue === enteredSearchTerm.value) { if (newValue === enteredSearchTerm.value) {
@ -53,7 +57,7 @@ export default {
} }
}, 300); }, 300);
}); });
watch(props.user, function() { watch(user, function() {
enteredSearchTerm.value = ''; enteredSearchTerm.value = '';
}); });