primevue icon indicating copy to clipboard operation
primevue copied to clipboard

DataTable: Maximum recursive updates exceeded in component <DataTable>

Open caputech opened this issue 5 months ago • 1 comments

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 <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.

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 avatar Feb 11 '24 19:02 caputech

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

caputech avatar Feb 23 '24 20:02 caputech

@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

jsisson avatar Feb 26 '24 14:02 jsisson

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.

caputech avatar Feb 26 '24 16:02 caputech

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.

Marlight avatar Mar 06 '24 09:03 Marlight

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

satyavh avatar Mar 25 '24 14:03 satyavh

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}, });

nonpsisvi1983 avatar Apr 05 '24 15:04 nonpsisvi1983