Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: Maximum recursive updates exceeded in component <DataTable> #5261

Closed
caputech opened this issue Feb 11, 2024 · 10 comments
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@caputech
Copy link

Describe the bug

Starting with Vue v3.4.15, DataTable throws the following error when Row Grouping is used in combination with Advanced (menu type) filters.

Uncaught (in promise) Maximum recursive updates exceeded in component . 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.

Reproducer

https://stackblitz.com/edit/3avo74?file=src%2FApp.vue

PrimeVue version

3.45.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

Go to reproducer and check the console.

There are some related issues raised in the Vue repository. https://github.com/vuejs/core/issues?q=maximum+recursive+updates

Expected behavior

No response

@caputech caputech added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 11, 2024
@caputech
Copy link
Author

Any update on this one? It is a fairly significant issue for us. Thanks.

@jsisson
Copy link

jsisson commented Feb 26, 2024

@caputech I was having this same issue, and after double-checking I had realized I had accidentally messed up the "filters" variable in my script;

<template>
<DataTable
    v-model="filters"
   .../>
</template>
<script setup>
import { ref } from "vue";
const filters = ref(); // OOPS
</script>

When I fixed the filters variable this error went away;

...
const filters = ref({
    global: { value: null, matchMode: FilterMatchMode.CONTAINS },
    name: { value: null, matchModel: FilterMatchMode.CONTAINS },
    (etc)
});
...

Maybe this helps you too

@caputech
Copy link
Author

Thanks, but no, I have them set correctly. It seems to be a result of using the filtering and grouping together. Only appeared in recent VUE updates as they are enforcing conventions.

@Marlight
Copy link

Marlight commented Mar 6, 2024

I have the same error from Vue version >= 3.4.15

const filters: Ref<DataTableFilterMeta> = ref({
    global: {value: null, matchMode: FilterMatchMode.CONTAINS}
});
<DataTable
                    :value="productsMock"
                    v-model:filters="filters"
                    row-hover
                    striped-rows
                    size="small"
                    rowGroupMode="subheader"
                    group-rows-by="category"
                    sort-field="category"
                    data-key="id"
                    :sort-order="1"
                    :global-filter-fields="['title', 'tags']"
                > <!-- ... --> </DataTable>

Uncaught (in promise) Maximum recursive updates exceeded in component <DataTable>. 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.

@satyavh
Copy link

satyavh commented Mar 25, 2024

I run into this error constantly, really annoying. Datatables seems to have a nag for mutating its props for no apparent reason

@nonpsisvi1983
Copy link

I was having the same issue, and comparing exampIe and my code I had realized I had non existing field in my filters

Before:
const filters = ref({
global: {value: null, matchMode: FilterMatchMode.CONTAINS},
name: {value: null, matchMode: FilterMatchMode.STARTS_WITH}, # field does not exists
dns: {value: null, matchMode: FilterMatchMode.STARTS_WITH},
});

After:
const filters = ref({
global: {value: null, matchMode: FilterMatchMode.CONTAINS},
ip: {value: null, matchMode: FilterMatchMode.STARTS_WITH},
dns: {value: null, matchMode: FilterMatchMode.STARTS_WITH},
});

@cajund
Copy link

cajund commented Oct 7, 2024

I've been trying every which way to get aware from this without significant hacks. Consider the following:

      <DataTable :value="LinkStore.links.out_links" tableStyle="">
        <Column field="from_node" header="From Local Node">
          <template #body="props">
            <div>{{ nodes[props.data.from_node] }}</div>
          </template>
        </Column>

That nodes variable is local, and is an object keyed by that "from_node" id. This code produces an object. This works, the object is printed to my table. However, changing that to the following (just referencing the field):

<div>{{ nodes[props.data.from_node].public_name }}</div>

Will cause this recursion error to happen. The nodes local var is indicated to be "reactive" in the Vue tools, and I and convinced this has something to do with this error. I've tried lots of different approaches, all with the same result (referencing a field causes the error). What isn't clear is while I can display the whole object, I can't display a single field.

How can this not be a bug?

Thanks.

@CrispinStichartFNSB
Copy link

CrispinStichartFNSB commented Nov 8, 2024

I ran into this same issue, and essentially it seems that any exceptions thrown from code that runs in a <Column>'s slot will be eaten, and then trigger this endless recursion.

I have a test app here that displays this behavior.

https://stackblitz.com/edit/vitejs-vite-ywc6c5?file=src%2FApp.vue

(Edit: I think I messed else up with that stackblitz app, I'm fixing now fixed, still displays the recursion error)

@cajund
Copy link

cajund commented Nov 9, 2024

I can confirm this as well. There's some oddities with this component, like due to the number of moving pieces. But you are correct, any exception will exhibit this behavior - finding the specific exception can be a bit of a challenge.

The issue I posted was slightly different, but given your report, replicating it may be challenging.

Perhaps this component can be adjusted to trap these exceptions and limit the responsive behavior - presenting the error for readily to the user.

Cheers!

@changhua0313
Copy link

We ran into this issue.
Use filters in columngroup / column

<column ...>
<template #filter="{ filterModel }">
......



vue: 3.4.21, primevue: 4.2.5 -> Maximum recursive updates exceeded in component
vue: 3.4.21, primevue: 3.53.0 -> Works fine
Is there any work around for primevue 4? Any hint is appreciated.

FlorentGimaret pushed a commit to FlorentGimaret/primevue that referenced this issue Feb 18, 2025
@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 19, 2025
@tugcekucukoglu tugcekucukoglu added this to the 4.3.0 milestone Feb 19, 2025
@github-project-automation github-project-automation bot moved this to Review in PrimeVue Feb 19, 2025
@tugcekucukoglu tugcekucukoglu self-assigned this Feb 19, 2025
tugcekucukoglu added a commit that referenced this issue Feb 19, 2025
tugcekucukoglu added a commit that referenced this issue Feb 19, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in PrimeVue Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Done
Development

No branches or pull requests

9 participants