Questions tagged [vue-reactivity]

Inquiries regarding Vue's reactivity, a feature that automatically updates array and object properties upon any changes.

What is the reason for the Vue effect not being executed through the scheduler upon initialization of the effect?

What is the reason for the vue effect not going through the scheduler upon initialization? effect( () => { console.log('effect'); }, { scheduler: (job) => { console.log('run by scheduler'); job(); }, ...

Vue recalculate computed value only when result changes

Let's dive into a simplified version of the problem at hand: export default { data () { return { i_change_alot: 0, }; }, mounted() { setInterval(() => { this.i_change_alot = Math.random(); ...

The power of Vue reactivity in action with Typescript classes

Currently, I am working on a Vue application that is using Vue 2.6.10 along with Typescript 3.6.3. In my project, I have defined a Typescript class which contains some standard functions for the application. There is also a plugin in place that assigns an ...

Exploring the reactivity of Vue on object graphs that include cyclic references

First and foremost, let me provide some context: I am currently in the process of developing a minesweeper application using VueJS. The grid is structured as an object tree, where each Box object contains a 'neighbors' property that stores Box o ...

Revamp the props structure in Vue3 while preserving reactivity

When working with a component that retrieves API data and passes it down to child components, I encountered an issue. I attempted to split the information into separate ref objects for each child component but ran into a problem - reactivity was lost. The ...

How can Vue detect modifications made in the edited field?

I am facing an issue with tracking changes in a specific object. Here is the structure of the object: users: { email: '', password: '' } My goal is to detect any edits made to the keys within the users object and store the key ...

VueJS - Best practices for utilizing getters and computed properties efficiently

Vue.js has a special place in my heart, especially its computed properties and the magic of Vuex getters. However, I've reached a crossroads where I'm unsure if my current approach may be impacting performance. This pattern features prominently in my code ...

The Vue component fails to display the updated data even after the prop data has been modified

This is the parent component called abc.vue <v-card outlined class="mt-4"> <DetailsTable v-show="toggleClientData" :columnDefs="columnDefs" :rowData="rowData" /> </v-card> methods:{ aggridData() { let self = this; th ...

Troubleshooting Vue's reactivity problem with updating array element properties

I'm experiencing a reactivity problem in the example below. I can't figure out what I'm doing wrong. Is my vue data set up correctly or is there something else I need to do? Here's how my object model looks: export default { data ...

What causes Vue to only update once when there are two closely timed mutations to reactive data?

Can you take a look at this simple example? export default { data() { return { name: "Amy", age: 18, }; }, computed: { combinedDataForWatching() { return { name: this.name, age: this.age, ...

Ways to remove items from Vuex store by utilizing a dynamic path as payload for a mutation

I am looking to implement a mutation in Vuex that dynamically updates the state by specifying a path to the object from which I want to remove an element, along with the key of the element. Triggering the action deleteOption(path, key) { this.$store.d ...

The performance problem of calling a method in a Vue 2 v-for loop

Can someone help me understand why my code is calling someFunction() four times instead of just once? This is the structure: <div id="app"> <div v-for="item in items" :key="item.id"> <input v-model=" ...

Discover how to fetch data within Vue component using data access object in Vue 3

I am in the process of utilizing a data access object (dao) named Todos.js to fetch necessary data for a Vue3 component called List.vue. Below, you will find snippets from my code as an example. Upon initializing the application, the data is successfully ...

What causes regular objects to become automatically reactive in Vue3?

There is an example discussed in this particular article. It mentions that a normal object is not 'reactive'. Upon testing in this codesandbox environment, it was observed that changes made to the normal object, including a plain string, can automatically ...

`Can v-model be used to update the key of an object within an array element?`

My form is designed to fetch questions from an API, and I am looking to collect answers in separate input fields for each question. To achieve this, I have set up a response array with a length greater than or equal to the number of questions, pre-filling ...

What steps can be taken to ensure that all object properties become reactive?

Let's dive into this simplified scenario: interface Pup { name: string; age: number; } const puppy: Pup = { name: 'Rex', age: 3, }; The goal here is to establish a reactive link for each attribute within the puppy object. The usua ...

Tips for maintaining reactivity in nested object properties in external JavaScript class files without relying on Vue.set()

In my possession is this particular component: <template> <div class="simple-editor"> {{editor.view.toolbarManager.buttons}} <component v-for="(button, name) in editor.view.toolbarManager.buttons" ...

There seems to be an issue with the reactivity in the Vue Composition API

Currently utilizing Vue2, Vuetify, and the Vue Composition API (@vue/composition-api). Encountering an issue with the reactivity of the composition API. Let's delve into some code snippets: ---- companies.vue ---- <template> ... <v-data-tabl ...

"The Vue component's data is successfully updating within a method using setInterval(), however, the changes are not reflected in the DOM

I have a function in my methods that gets triggered with a @click in the view. The function starts a timer, and although it seems to work fine in the DevTools, the timer only updates in the DevTools when I refresh the page. Moreover, in the view, the time ...