| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Before, setting `Graph.options.foldingEnabled = false` on one `Graph` instance affected other instances too — because the `options` object was shared between them. For example, switching to the Constituent story (which disables `Graph.options.foldingEnabled`) then back to another story relying on the default (`true`) would break folding: the folding icon disappeared and cells couldn't be collapsed anymore. This could be seen with the `Collapse` and the `Folding` stories. The bug exists at least as of version 0.14.0, but probably from the first version of maxGraph. 🔍 Root cause: `options` was defined via mixins as an object, but the internal `applyMixin` function probably copies object references, not values — effectively making `Graph.options` global. ✅ Fix: move the `options` property directly onto the `Graph` class. It's the only object-typed prop in our mixins, and we're planning to turn `FoldingMixin` into a plugin anyway — so this fix is simple and future-proof. ℹ️ No impact for users, just internal code structure changes. In addition, migrate Constituent.stories.js to TypeScript to ease future maintenance.
WalkthroughThe changes update documentation for i18n configuration, introduce and integrate a new GraphFoldingOptions type for configuring graph folding behavior, and refactor the folding mixin definitions by removing redundant options and type dependencies. In addition, the pull request enhances the type safety and event-handling methods in a constituent story. No alterations were made to exported or public entities aside from these modifications. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Graph
participant FoldingManager
User->>Graph: Trigger fold/expand action
Graph->>FoldingManager: Retrieve folding options
FoldingManager-->>Graph: Return configured ImageBox (collapsed/expanded)
Graph-->>User: Update visual with folding image
sequenceDiagram
participant User
participant MyCustomGraph
participant Template
User->>MyCustomGraph: Initiate mouse event
MyCustomGraph->>MyCustomGraph: getInitialCellForEvent(event: InternalMouseEvent)
MyCustomGraph->>MyCustomGraph: isPart(cell: Cell | null)
MyCustomGraph->>MyCustomGraph: selectCellForEvent(cell: Cell, event: MouseEvent)
MyCustomGraph-->>User: Update selection based on event
Suggested labelsrefactor 📜 Recent review details Configuration used: CodeRabbit UI Reviewing files that changed from the base of the PR and between 6a003ee and 2b7cdb3. 📒 Files selected for processing (6)
packages/core/src/types.ts (1)packages/html/stories/Constituent.stories.ts (1) packages/core/src/types.ts (1)⏰ Context from checks skipped due to timeout of 90000ms (1)
packages/core/src/i18n/config.ts (2)✨ 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. ❤️ Share 🪧 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 (.coderabbit.yaml)
Documentation and Community
|
Sorry, something went wrong.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Before, setting Graph.options.foldingEnabled = false on one Graph instance affected other instances too - because the options object was shared between them.
For example, switching to the Constituent story (which disables Graph.options.foldingEnabled) then back to another story relying on the default (true) would break folding: the folding icon disappeared and cells couldn't be collapsed anymore.
This could be seen with the Collapse and the Folding stories.
The bug exists at least as of version 0.14.0, but probably from the first version of maxGraph.
🔍 Root cause: options was defined via mixins as an object, but the internal mixInto function probably copies
object references, not values — effectively making Graph.options global.
✅ Fix: move the options property directly onto the Graph class.
It's the only object-typed prop in our mixins, and we're planning to turn FoldingMixin into a plugin anyway — so this fix is simple and future-proof.
ℹ️ No impact for users, just internal code structure changes.
In addition, migrate Constituent.stories.js to TypeScript to ease future maintenance.
Summary by CodeRabbit
New Features
Refactor
Documentation