GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(stories): set the image base path for every story by redfish4ktc · Pull Request #1333 · maxGraph/maxGraph

Conversation

@redfish4ktc

@redfish4ktc redfish4ktc commented Nov 18, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • The error dialog ignores the image base path set by the application #1331: GuiConfig.errorImage is computed when maxGraph is imported, so it ignores the base path set afterwards. Not used by the stories.
  • Build the image URLs of the stories from the configured image base path #1332: the stories mix image URLs built from Client.imageBasePath with hard-coded images/... paths.

🤖 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.

All reactions
redfish4ktc added 3 commits November 17, 2026 12:42
@redfish4ktc
fix(stories): set the image base path for every story
9be1fca
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.
@redfish4ktc
refactor(stories): remove the workaround redefining the fold images
4004645
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.
@redfish4ktc
docs(stories): explain where the image base path of the demo is set
2bff38d
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.
@redfish4ktc redfish4ktc added bug Something isn't working skip-changelog Do not include in Changelog and Release Notes labels Nov 18, 2026
@redfish4ktc redfish4ktc mentioned this pull request Nov 18, 2026
chore(claude): add a skill checking that every story renders #1329
Merged
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Explain Change →

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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

  • X
  • Mastodon
  • Reddit
  • LinkedIn
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonarqubecloud

sonarqubecloud Bot commented Nov 18, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@redfish4ktc
redfish4ktc merged commit ace24d6 into main Nov 18, 2026
14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@redfish4ktc
redfish4ktc deleted the fix/storybook_image_base_path branch November 18, 2026 06:01
@coderabbitai coderabbitai Bot mentioned this pull request Nov 19, 2026
refactor(stories): build image URLs with a shared getImagePath helper #1337
Open
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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

Projects

None yet

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.

1 participant

@redfish4ktc
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.