fix: use the right list of excluded fields in GraphCodec#777
Conversation
Doing an export/encode of a Graph generated an error "Maximum call stack size exceeded. RangeError: Maximum call stack size exceeded". In `GraphCodec`, the list of excluded fields was incorrect: - `selection` was in the list, but this field doesn't exist, it is named `selectionModel`. The bug already existed in mxGraph https://github.com/jgraph/mxgraph/blob/v4.2.2/javascript/src/js/io/mxGraphCodec.js#L26 - `plugins` was missing. There is currently no codec for Plugin so it is not supported for now Tests have been added to validate that the Graph import/export works. In all existing tests involving Codecs, unregister all codecs before and after to ensure there is no side effects between tests.
|
""" WalkthroughThe changes introduce a new test suite for graph serialization and deserialization, enhance codec registration management in existing test files, and refactor codec registration logic for better modularity. The Changes
Sequence Diagram(s)sequenceDiagram
participant TestSuite as Test Suite
participant Codec as Codec Registry
participant Graph as Graph Instance
TestSuite->>Codec: unregisterAllCodecs() (beforeAll/afterEach)
TestSuite->>Codec: register codecs as needed
TestSuite->>Graph: create Graph instance (with/without plugins)
TestSuite->>Codec: export Graph to XML
TestSuite->>Codec: import XML to Graph
TestSuite->>Graph: verify properties after import/export
Possibly related PRs
Suggested labels
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|



Doing an export/encode of a Graph generated an error "Maximum call stack size exceeded. RangeError: Maximum call stack size exceeded".
In
GraphCodec, the list of excluded fields was incorrect:selectionwas in the list, but this field doesn't exist, it is namedselectionModel.The bug already existed in mxGraph https://github.com/jgraph/mxgraph/blob/v4.2.2/javascript/src/js/io/mxGraphCodec.js#L26
pluginswas missing. There is currently no codec for Plugin so it is not supported for nowTests have been added to validate that the Graph import/export works.
In all existing tests involving Codecs, unregister all codecs before and after to ensure there is no side effects between tests.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores