GeezerVison is showing github.com — fix(stories): set the image base path for every story by redfish4ktc · Pull Request #1333 · maxGraph/maxGraph
Conversation
redfish4ktc
commented
Nov 18, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
The Groups, Labels, Rotation and Scrollbars stories request /expanded.gif and get a 404, both with storybook dev and with the static build, so their fold icon is missing. The problem was detected by the Storybook check introduced in #1329, while validating the Storybook upgrade of #1320.
Cause
Each story had to call configureImagesBasePath() itself, and these 4 stories never did, so Client.imageBasePath kept its '.' default. The value is static and survives from one story to the next in the Storybook iframe, so a story without the call worked whenever a story with it had been opened before: the 404 only shows when the story is loaded first.
Changes
.storybook/preview.ts sets Client.setImageBasePath('./images') in the reset applied before each story, which also restores it when a story changes it. The 25 per-story calls and the configureImagesBasePath helper are removed.
configureExpandedAndCollapsedImages is removed too. It rebuilt the fold images of a graph after its creation, assuming the defaults were computed when maxGraph is imported. That is no longer the case: AbstractGraph builds its options in the constructor, so the defaults already use the base path set before the story.
- The introduction page of the demo explains what the shared configuration does for a reader reusing the code of a story, and the images page of the website says where the demo sets the base path.
Verification
Each of the 82 stories was loaded alone, in a fresh browser context, against storybook dev, collecting the failed requests and the page errors:
| Story |
main |
This branch |
| Groups, Labels, Rotation, Scrollbars |
404 on /expanded.gif |
200 on /images/expanded.gif |
| Collapse, Folding, SwimLanes (used the removed workaround) |
200 under /images |
200 under /images |
| The other 75 stories, including Toolbar (used the workaround, but its graph starts empty) |
no failed request |
no failed request |
npm run build -w packages/website passes.
Follow-ups
🤖 Generated with Claude Code
Summary by CodeRabbit
- Documentation
- Clarified that Storybook demos configure a shared image path for all stories, and that applications reusing story code should configure the path and provide the images.
- Refactor
- Centralized image-path configuration for Storybook demos. Individual examples no longer configure image paths or expanded and collapsed images themselves.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The Groups, Labels, Rotation and Scrollbars stories requested /expanded.gif and got a 404: they never called
configureImagesBasePath, so Client.imageBasePath kept its '.' default. Each story had to remember to call it, and
forgetting went unnoticed whenever a story calling it had been opened before, since the value is static and survives
from one story to the next in the Storybook iframe.
The base path is now set in the reset applied by .storybook/preview.ts before each story, which also restores it if a
story changes it. The per-story calls and the helper are removed, and the introduction page says where the setting
lives, for readers reusing the code of a story in their own application.
configureExpandedAndCollapsedImages rebuilt the collapsed and expanded images of a graph after its creation, on the
assumption that the default images were computed when maxGraph is imported, before a story sets the image base path.
That no longer holds: AbstractGraph initializes its options in the constructor, so the defaults already use the base
path set before each story by .storybook/preview.ts.
Checked by loading every story alone in a fresh browser context: the four stories that used the workaround still
request their fold images under /images, with no failed request.
The stories no longer set the image base path themselves, so code copied from one of them works in an application only
if that application sets it too. The introduction page of the demo now says what the shared configuration does for
such a reader, and the images page of the website says where the demo sets it.
The website page names preview.ts without linking to it: a permalink would need a commit containing the setting,
which exists only once this change is merged.
coderabbitai
Bot
commented
Nov 18, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
Storybook now sets the image base path in its global preview configuration. Story templates no longer set it individually or apply expanded and collapsed image configuration. The documentation describes the global setting and requirements for reusing story code.
Changes
Storybook image path configuration
| Layer / File(s) |
Summary |
Global image configuration packages/html/.storybook/preview.ts, packages/html/stories/shared/configure.js |
resetMaxGraphConfigs sets the image base path to ./images. The shared image-path and expanded/collapsed-image helpers are removed. |
Story template migration packages/html/stories/*.stories.*, packages/html/stories/Introduction.mdx, packages/website/docs/usage/css-and-images.md |
Story templates no longer call the removed helpers. Documentation describes the global image path configuration and notes that applications reusing story code must set the path and provide the images. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested labels: bug
Suggested reviewers: tbouffard
Merge Risk: Minimal · up to 2bff3
-
This change centralizes the Storybook image path setup and removes duplicated per-story calls. No concrete regressions were identified, so it looks safe to merge.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title follows the Conventional Commits form (fix(stories): ...) and names the main change: the image base path is now set for every story. The changeset moves the base path setup into .storybook/p… |
| Description check |
 |
The description follows the template. It has an Overview with the cause, the changes, and a verification table. It links the work to the Storybook check (#1329) and the upgrade (#1320) and lists follo… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title follows the Conventional Commits form (fix(stories): ...) and names the main change: the image base path is now set for every story. The changeset moves the base path setup into .storybook/preview.ts and removes the per-story calls, which fixes the missing /expanded.gif fold icon in four stories. The title is concise and specific.
Full details: Description check
-
Explanation
The description follows the template. It has an Overview with the cause, the changes, and a verification table. It links the work to the Storybook check (#1329) and the upgrade (#1320) and lists follow-ups (#1331, #1332). The PR checklist from the template is not present. The description does not state a closing keyword for an issue, and it does not include screenshots. The author also does not say whether a Storybook story or test covers the change, though the verification table covers the stories.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
Recent review info
-
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
fce79b2c-7b16-4486-932d-a5e26d42e0f1
Commits
-
Reviewing files that changed from the base of the PR and between dac5e0a and 2bff38d.
Files selected for processing: 29
-
packages/html/.storybook/preview.ts
packages/html/stories/Anchors.stories.ts
packages/html/stories/Collapse.stories.ts
packages/html/stories/ColorStylePlaceHolders.stories.ts
packages/html/stories/ContextIcons.stories.ts
packages/html/stories/DynamicToolbar.stories.ts
packages/html/stories/EdgeCurvedAndRounded.stories.ts
packages/html/stories/Events.stories.ts
packages/html/stories/FixedPoints.stories.ts
packages/html/stories/Folding.stories.ts
packages/html/stories/HelloPort.stories.ts
packages/html/stories/HoverIcons.stories.js
packages/html/stories/Introduction.mdx
packages/html/stories/JsonData.stories.ts
packages/html/stories/MenuStyle.stories.ts
packages/html/stories/Monitor.stories.ts
packages/html/stories/Overlays.stories.ts
packages/html/stories/Permissions.stories.js
packages/html/stories/PortRefs.stories.ts
packages/html/stories/SwimLanes.stories.ts
packages/html/stories/Thread.stories.ts
packages/html/stories/Toolbar.stories.ts
packages/html/stories/Tree.stories.js
packages/html/stories/UserObject.stories.ts
packages/html/stories/Validation.stories.ts
packages/html/stories/Window.stories.ts
packages/html/stories/Wires.stories.ts
packages/html/stories/shared/configure.js
packages/website/docs/usage/css-and-images.md
Files with no reviewable changes: 1
-
- packages/html/stories/shared/configure.js
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
bug
Something isn't working
skip-changelog
Do not include in Changelog and Release Notes
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|