Skip to content

"Maximum recursive updates exceeded" message with Vue > 3.4.14 #312

Closed
@lmc3s3f0r

Description

@lmc3s3f0r

Describe the bug
In a project with vue3-openlayers, having a Vue version higher than 3.4.14, I'm getting this error message: "Uncaught (in promise) 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 not getting the error message with Vue 3.4.14.

Affected version(s)

Please run npm list --depth=0 vue vue3-openlayers ol ol-ext ol-contextmenu and paste the output below:

nuxt-app@ /home/lmcsf/Desktop/work/dev/repos/bug_reports/openlayers_max_recursive
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repo: https://github.com/lmc3s3f0r/openlayers_max_recursive_updates_bug
  2. Run npm install and then npm run dev to launch it
  3. Go to Chrome's console
  4. See error meesage "Uncaught (in promise) 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."
  5. The error doesn't appear when you go to components/MapOL.client.vue and comment lines 81 to 83 (the setTimeout function) and uncomment the line 85 (same action, but without setTimeout).

Expected behavior
I'd expect not to have this error message, same as with Vue 3.4.14.

Desktop (please complete the following information):

  • OS: Ubuntu 22
  • Browser: Chrome

Additional context
I'm working on a big project with heavy use of OpenLayers maps, and when we recently updated Nuxt and Vue versions, we found this error and we can't figure out where it's coming from (Vue or vue3-openlayers).

The project is quite big so I provided this small version. The error is caused in the file /components/MapOL.vue, line 82. If you comment that line, the error message doesn't appear, but in that case we can't show polygons in the map.

A recent Vue update seemed to fix this error message for many users, but not for our project.

We're currently stuck on Vue 3.4.14 because updating to a higher version causes this error everywhere (and we'd like to update Vue so we can update other packages that need Vue 3.4.19 or higher).


UPDATE:
The latest 4.1.2 version does fix the issue, although I was still having it in the actuall app I found this bug on, so I've updated the reproduction project linked above (https://github.com/lmc3s3f0r/openlayers_max_recursive_updates_bug) and I'm able to reproduce the issue again.

Apparently the problem only happens when using "setTimeout". If you go to components/MapOL.client.vue, comment lines 81 to 83, and uncomment line 85, no error appears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions