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

Fix "TypeError: Converting circular structure to JSON" when passing hyperformulaInstance to hotSettings #10186

Merged
merged 4 commits into from Dec 13, 2023

Conversation

tonextone
Copy link
Contributor

Context

Fixes the issue #8728 (comment) .

For JSON.stringify() is used to compare hotSettings (current ⇔ new) ,
any circular structure ( like hyperformulaInstance ) within hotSettings
causes this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value

How has this been tested?

Added a test case.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

  1. Fix [9.0.0+] Adding HyperFormula leads to "TypeError: Converting circular structure to JSON" #8728

Affected project(s):

  • handsontable
  • @handsontable/angular
  • @handsontable/react
  • @handsontable/vue
  • @handsontable/vue3

Checklist:

@tonextone tonextone changed the title Fix "TypeError: Converting circular structure to JSON" when passing hyperformulaInstance Fix "TypeError: Converting circular structure to JSON" when passing hyperformulaInstance to hotSettings Dec 21, 2022
@AMBudnik
Copy link
Contributor

Thank you very much for creating the pull request, signing CLA, and adding the test scenario.
I am adding the ready for review label. We will proceed with the code review as soon as possible.

@171h
Copy link

171h commented May 18, 2023

why not merge? I have the same problem.

cc: @kirszenbaum @AMBudnik @adrianszymanski89

@handsontable_vue3.js:127  Uncaught (in promise) TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Rule2'
    |     property 'definition' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Alternation2'
    |     ...
    |     index 1 -> object with constructor 'NonTerminal2'
    --- property 'referencedRule' closes the circle
    at JSON.stringify (<anonymous>)
    at simpleEqual (@handsontable_vue3.js:127:15)
    at prepareSettings (@handsontable_vue3.js:115:128)
    at Proxy.handler (@handsontable_vue3.js:141:24)
    at callWithErrorHandling (chunk-J7TRJLPB.js:213:18)
    at callWithAsyncErrorHandling (chunk-J7TRJLPB.js:221:17)
    at job (chunk-J7TRJLPB.js:1810:9)
    at callWithErrorHandling (chunk-J7TRJLPB.js:213:32)
    at flushJobs (chunk-J7TRJLPB.js:411:9)
    at flushJobs (chunk-J7TRJLPB.js:421:7)

@budnix
Copy link
Member

budnix commented Dec 12, 2023

@tonextone Can I ask you to add a changelog file? You can generate that by running npm run changelog entry in the project's root dir. Then, I'll be able to merge the PR.

@tonextone
Copy link
Contributor Author

@budnix Thank you for the follow-up. I just added a changelog entry.

( It's my first time, so I'm not sure if it's perfect. )

@budnix budnix self-requested a review December 13, 2023 07:05
@budnix budnix merged commit e2b07e5 into handsontable:develop Dec 13, 2023
18 of 19 checks passed
@AMBudnik
Copy link
Contributor

Thank you again for your contribution @tonextone
The changes are published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[9.0.0+] Adding HyperFormula leads to "TypeError: Converting circular structure to JSON"
4 participants