Warning: The recursion limit has been exceeded in VUEjs 3, please review your

Recently, I've encountered a warning from Vue that says: "Maximum recursive updates exceeded. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function."

I'm having trouble pinpointing where the error lies. I go through 2 loops and then assign a counter value to the component inside, which is then passed on and interpreted by modulus to apply CSS classes in the 3rd level.

This setup is necessary because the components created are part of a dynamically generated CSS grid where I want to ensure that each row has uniform "even/odd" classes for all cells at the same height.

Here's the vue-component responsible for this increment:

<template>
    <template v-for="(project, p) in projects" :key="project.id">
        <template v-for="(component, c) in project.components" :key="component.id">
            <grid-swim-lane
                :project="project"
                :component="component"
                :grid-row-even-odd-count="evenOddCount++"
            />
        </template>
    </template>
</template>

<script>
import GridSwimLane from "./GridSwimLane";
import {mapGetters} from "vuex";

export default {
    components: { GridSwimLane },
    data() {
        return {
            evenOddCount: -1
        }
    },
    computed: {
        ...mapGetters('projects', { projects: 'getAllProjects' })
    },
}
</script>

<style scoped></style>

The issue persists despite successfully passing the increment value to the last component. Any suggestions on how to resolve this warning? I've tried various approaches but haven't made progress.

Using CSS selectors is not an option for me as I need to work with fixed classes.

Appreciate any insights or tips you may have. Thank you!

Answer №1

After some exploration, I discovered that the value of this.$.uid in each grid-swim-lane component is not sequential, but rather follows a sequence of even and odd numbers :-)

Therefore, I utilized this value to differentiate between the 'even' and 'odd' css-classes:

<template>

    <!-- ------------------ BEGIN LEFT SIDE BAR ------------------ -->

    <grid-swim-lane-info
        :grid-row-even-odd-count="gridRowEvenOddCount"
    />

    <!-- ------------------ BEGIN RELEASES ------------------- -->

    <grid-swim-lane-releases
        :grid-row-even-odd-count="gridRowEvenOddCount"
    />

</template>

<script>
import GridSwimLaneInfo from "./GridSwimLaneInfo";
import GridSwimLaneReleases from "./GridSwimLaneReleases";

export default {
    components: {
        GridSwimLaneInfo, GridSwimLaneReleases
    },
    props: {
        component:   { type: Object, default: { id: 0, name: 'no-component'} }
    },
    data() {
        return {
            gridRowEvenOddCount: 0
        }
    }
    mounted() {
        this.gridRowEvenOddCount = this.$.uid;
    }
}
</script>

<style scoped></style>

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

JavaScript closures compared to instances of classes

Exploring the realm of theoretical programming rather than practical applications, my focus has turned towards closures in JavaScript. In essence, a closure is a function with its own exclusive set of variables that are not accessible to copies of the func ...

React's nested map function is failing to display any results

My objective is to loop through nested arrays in the response data, which is an array containing other arrays. However, I am encountering an issue where the data is not being displayed for some reason. Here is an example of one item in the response: id: 5 ...

Discover the number of hits with the power of ajax and javascript

We are looking to implement a feature on our page that allows users to add websites. The goal is for our application to generate JavaScript code that can be embedded into a website, resulting in hits being sent to the added websites whenever a user visits ...

Different ways to modify the underline and label color in Material-UI's <Select/> component

A while ago, I came across this useful demo that helped me change the colors of input fields. Here is the link: https://stackblitz.com/edit/material-ui-custom-outline-color Now, I'm on a quest to find a similar demo for customizing the color of selec ...

When cycling through an array in ReactJS, HTML tags are not displayed or processed

I'm diving into the world of ReactJS and trying to grasp the fundamental concepts. To pros out there, my question might seem like a beginner's query ;) Here's the component I am working on: import React from "react"; function Nam ...

Is it possible to modify the accumulator data type in the .reduce function?

Recently, I've been attempting to transform a string into an array of numbers[], however, my lack of experience with TypeScript has led me to struggle with properly typing my code to satisfy the TypeScript compiler... My objective is as follows: matS ...

The lack of definition for the Nuxtjs document is causing an issue

Currently, I am in the process of setting up a reviews page within nuxtjs. To achieve this, I have integrated the vue-star-rating library into my project. However, I have encountered an error despite attempting various solutions that have worked for others ...

When using angularjs, the $window.location.href may cause the page to load without any

I have a dilemma where I have linked all my CSS and JS files in the index.html file, but subpages are located in a templates directory. When using $window.location.href, only a plain HTML page is returned without any CSS styles. The page renders fine when ...

Guide to removing values from an HTML selected list box with a single click

Being a beginner in Jquery, I encountered an issue with deleting values in batches of 3. When I try to remove categories by clicking the "Remove Category" button, it seems to select and delete them one at a time or two at a time instead of removing them in ...

Using Hapi & Async for your API - How can you clear an array or execute a function immediately after sending a "reply" or at every new "get" request?

In the midst of developing a small API that retrieves data, performs tasks on it asynchronously, stores some of this data in an array using push, and then presents it to a client through Hapi's reply(). My goal is to clear out the array (e.g., using ...

Unexpected behavior of ion-select: No rendering of selected value when applied to filtered data

I came across an unexpected issue with the dynamic data filtering feature of ion-select. In my application, users are required to choose three unique security questions during registration. I have an array of available questions: questions: Array<{isSe ...

Determine whether a child node is an element or a text node using JavaScript

I am experiencing an issue with the childNodes property. Here is the scenario: <ol> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ol> //childNodes.length = 7 However, <ol><li> ...

Ways to ensure the title changer works seamlessly for everyone

Having a title changer for elements visible in the viewport is crucial. However, the current setup only works for a single division and fails to function with multiple divisions. Click Here for Live Testing and Viewing Check out the jsFiddle for Code V ...

JavaScript: A guide on sending an uploaded email to a web service in byte array format

Scenario: My website is built using EXTJS6. I have a web service that requires the uploaded email to be sent in byte array format. Inquiry: What is the process for converting a .msg file to a byte array using JS (or EXTJS)? Can we treat it as a simple bin ...

Node.js and SQL: Verify if a specific value exists in the column

In the process of developing a Discord bot using Node.js (discord.js), I have created a command named !add that requires 2 or more arguments. For example, !add Name This is the reply, where Name corresponds to args[0]. As part of my code, I check whether t ...

Issue with Parcel 2 - Error encountered: Module 'axios' not found

I have enrolled in a Udemy course called 'Node.js, Express, MongoDB & More'. The instructor uses parcel v1 in the course, but now that parcel has released v2, I am facing issues installing v1. I am attempting to access the file from the dist dire ...

Verify the form data before triggering the ajax call with just one click

Ensuring that all required areas are completed in a form is crucial. The form needs to be validated properly to either reject the request with a message showing what information is missing, or submit it successfully... The rejection process works well as ...

Sending data from a Flask application written in Python to a JavaScript file using AJAX for seamless integration

As I am still in the learning process, please bear with me. I have been making attempts to find solutions, but often encounter issues when sending data of type="POST" from JavaScript to Flask using AJAX. This is the code snippet from my app.py f ...

Organize the dataset into groups based on every possible key

Hi there, I'm facing a challenge while developing an application using NestJS/Prisma. The task at hand is to extract unique results from a table in order to display them in a filter on the front-end. Let me give you an overview of my table structure ...

What is the best way to evaluate and calculate the variances between two nested objects, ultimately identifying and returning the commonalities?

Here are the two variables I am working with: const var1 = { students: { grade: [ { subject: "Math3", name: "jack", mark: 60, attendance: 90, abscent: 2, }, ...