Skip to content

TypeError: Converting circular structure to JSON #2387

@lukaszarpak

Description

@lukaszarpak

Reproduction

https://stackblitz.com/edit/vue3-vite-starter-6fdvet?file=src%2Fmain.js

Steps to reproduce the bug

Navigate between routes

Expected behavior

Navigation should run without any errors

Actual behavior

After trying to navigate between routes there is such an error in the console:

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'

Additional information

The reason to set from object in the localStorage is to then use it to go back to it on another route, even if the user refreshes the page. from object should not have any circular dependencies inside of it, it's an anti pattern and should not be used. When the app is run in a dev mode the error does not occur, which also makes it inconsistent from the DX point of view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions