Vuejs may encounter challenges with v-model when numerous items are present on the page

My simple page consists of a form at the top for submitting data and a list below that, as shown in the image:

https://i.sstatic.net/3WjY2.png

The list is populated with data from an api, each object having only 4 properties. Currently, there are a total of 130 elements in the list. However, when I try to input something into the textarea, it becomes extremely slow (2-10 frames per second). The more items added to the list, the slower it gets. The form at the top contains a simple data object named form with the following structure:

form: {
  description: '',
  expired: '',
  applicationId: ''
}

An interesting aspect is that there is no shared data between the list and the form at the top, so they should function independently. When I comment out the list section, the textarea performance significantly improves.

Below is the code for rendering the list:

<b-card no-body class="box-shadowed">
    <b-card-body v-if="appKeys.length === 0">
      <h5>Seems there is no key available.</h5>
    </b-card-body>
    <b-list-group v-else flush>
      <b-list-group-item
        v-for="(key, index) in appKeys"
        :key="key.id"
      >
        <div class="d-flex w-100 justify-content-between">
          <p class="text-danger h6"><span class="text-dark">{{ index + 1 }} - </span> <i>{{ key.id }}</i></p>
          <div>
            <b-button variant="primary" title="Edit" @click="openEditModal(key.id, key.description, key.expired)">
              <b-icon :icon="'pencil'"/>
            </b-button>
            <b-button variant="danger" title="Delete" @click="deleteKey(index, key.id)">
              <b-icon :icon="'trash'"/>
            </b-button>
          </div>
        </div>
        <template v-if="key.expired">
          <b-badge variant="info">Expires on: {{ key.expired | formatDate }}</b-badge>
          <br/>
        </template>
        <small>
          <b>
            <i>Created by: {{ key.createdBy }}</i> on {{ key.created | formatDateTime }}
          </b>
          <br/>
          {{ key.description }}
        </small>

      </b-list-group-item>
    </b-list-group>

Removing

v-model="form.description"
from the textarea eliminates the issue once again. I initially suspected that the problem might lie within the <b-form-textarea> component from bootstrap-vue, but the same slowness occurs with a basic textarea input as well.

I attempted to analyze the Vue dev-tools panel and observed dropped frames whenever there were numerous items in the list, but I am unsure what else to investigate.

Does anyone have insights into why this slowdown may be occurring? Could it potentially be a limitation of Vue.js in handling a large number of items, or is there possibly a bottleneck in my code?

Edit

I can use v-once to improve the page speed, although I require reactivity when adding new elements to update the list below.

Answer №1

Encountered an issue related to Vue.js performance. According to the discussion:

Any modification in a template's dependency will cause the entire virtual dom of that component to be re-rendered.

As the list grows in size, more components need to be re-rendered, leading to slow performance. To address this, creating a separate child component for the section of HTML containing the list can prevent unnecessary re-renders when there are input changes in the parent component's <b-form-textarea>.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing Node and MongoDB to generate a shareable Favorites list with a unique URL

After spending a significant amount of time searching, I seem to be using the wrong search terms because I am struggling to find what I need. Essentially, my goal is to allow users to select items to add to a favorites list and then generate a unique URL t ...

Developing an export feature for a mean application

Attempting to develop a basic module for organizing accounts on a website seemed like a straightforward task. I thought it would be as simple as creating a file with some functions, wrapping it in module.exports, and everything would work smoothly. However ...

What is the process for activating my redux function within a component?

I'm working on a form that should create a new user when submitted. In my handleCreate function, I want to use Redux to trigger the addUser action and update the state to add the new user. However, it seems like I'm having trouble calling the act ...

The usage of nextTick in Vue.js and its role in updating components

Although I am a beginner with vue.js and have a basic understanding of it, I came across a sample code utilizing nextTick() today. Trying to comprehend its purpose led me to explore the documentation, which ended up complicating things further and leavin ...

Vue.js: EventBus.$on is not properly transmitting the received value

I recently started working with Vue and am currently exploring the best way to organize my event bus. In my project, I have a main layout view (Main.vue) that includes a router view where I pass emitted information from a child component like this: <te ...

Action of the Floater Button in Material UI

I'm currently working with Material UI's floater button component and I am having trouble getting it to open a menu onClick as intended. It is frustrating that there are no example codes available that demonstrate how to make the menu appear when ...

Transferring data from a JavaScript variable to PHP using AJAX

I’m currently working through the tutorial at http://www.w3schools.com/php/php_ajax_database.asp and I think I have a good grasp of how it all operates. This is my code: PHP: <?php include('./db.php'); $PM = mysqli_query($con, "SELECT DIS ...

Deliver a message using a loop in jade

I'm struggling with posting a request in Node and Jade using a specific ID. For instance, if Node returns a list of books : res.render('tests', {books: books}); In my Jade template, I display all the books by iterating through them. b ...

Issue with rendering an object's property using EJS

Trying to include the author's username in reviews within an ejs template for my app. The following code snippet: <%= review.author %> is functioning correctly and displays: { _id: 5eff6793e7f26811e848ceb1, username: 'mike', __v: 0 ...

Using jquery to remove textbox value when checkbox is unchecked

I have a single datatable created using jQuery. The first column of the table consists of checkboxes, and the last column contains textboxes. Because these elements are generated dynamically, they end up having identical IDs and names as shown below: $ ...

Update the value of a td element when a select option is changed in another td element within the same table row

I have a table set up as follows: Header1 | Header2 | Header3 | Header 4 | Header 5 Row 1 |<span>Some Text</span> | <select></select> Row 2 Row 3 . . . . Rows generated dynamically. My objecti ...

Typescript enhances Solid JS by using the "as" prop and the "component" prop

Hey there, I've been experimenting with solid-js lately and I'm facing a challenge integrating it with typescript. My objective is to make my styling more modular by incorporating it within my components. type RelevantTags = Exclude<keyof ...

Utilizing the sAjaxSource property in Datatables to fetch data through Ajax from multiple tables while dynamically passing arguments

I am facing an issue with populating two datatables using data retrieved from a flask API through a GET request. My data source URL is localhost:5000/data, but for some reason, I am unable to display the data in the datatables. Interestingly, when I use a ...

I am encountering difficulties while attempting to import Typescript files. Upon compiling them into Javascript, I am faced with errors in the web browser, specifically the issue of "exports is not defined"

When I run TodoAppUI.js:15, I get an error saying "Uncaught ReferenceError: exports is not defined" In all my classes, I use the export keyword. For example: export class mysclass { public constructor(){} } Even though I have the proper syntax for impo ...

The section element cannot be used as a <Route> component. Every child component of <Routes> must be a <Route> component

I recently completed a React course on Udemy and encountered an issue with integrating register and login components into the container class. The course used an older version of react-router-dom, so I decided to upgrade to v6 react router dom. While makin ...

Pass a data variable to an HTML file using express's sendfile function (quick inquiry)

Currently utilizing Node.JS, path, and express for running an HTML webpage. I need to pass a variable to the HTML file for its utilization: var client_cred_access_token = 'fakeToken'; ... app.get('/', function (req, res) { res.se ...

Error: Module not located - Unable to resolve 'crypto'

Upon running ng serve, I encountered a list of errors that need to be addressed. Here is my package JSON configuration: { "name": "ProName", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "tes ...

Sending data from Vue.js to Django Rest Framework using the Axios POST method

Encountered an issue while setting up a REST API with Vue.js and Django Rest Framework. The problem arises specifically when making a POST request. GET requests seem to work fine, but POST requests encounter errors. axios .get('http://127.0.0.1 ...

Guide on developing a Vue modal for transferring user input to a separate component

I have been working on creating a modal component that allows users to input data and then displays it in another component. For example, the user is prompted to enter their first and last name in a modal component (Modal.vue). Once the user saves this inf ...

Is there any method to determine whether a floated element has been pushed down?

Imagine a dynamic menu with floating elements, each set at a width of 150px. As the menu's width decreases, the elements progressively move to the next row. You are contemplating how to detect when an element has been moved down. One approach could b ...