Skip to content

Commit 87c32b3

Browse files
author
Jiří Fencl
committed
fix: 🐛 stabilize widget lifecycle, renderer, and input validation
Overhaul createWidgetLoader to correctly handle widget reuse across story re-renders: - await widget.unmount() before switching stories - treat null/missing args.widget as an early-return { widget: null } - preserve state and props keys that are absent from story args instead of forcing empty defaults - branch on available widget APIs (setProps / setState) to avoid clobbering load()-generated state when reusing the same story - clear stale state keys before calling setState (both setters present) so Storybook-provided state replaces rather than merges with load() output - guard against missing component plugin with a descriptive error Rewrite createVanillaRenderer with a per-widget WeakMap so multiple concurrent stories don't share render references: - add strict validation for options and ViewComponent - throw descriptive errors for ambiguous or non-callable component entries - guard string-key lookup to object-only ViewComponent maps - normalize null state/props to {} before calling widget setters - update(widget) now accepts the widget instance to target the correct container across multiple rendered widgets Add widgetProperties name/version validation to createPreviewConfig. Additional fixes: - fix(create-widget): correct className → class in vanilla ErrorView template - docs(storybook): update Storybook install commands to v9, switch to CSF3 object format with shared render, use Preact automatic JSX runtime, clarify two component-passing patterns for createVanillaRenderer, remove redundant widget argument from onClick/onReset event handlers Tests: expand suite with 30+ cases covering all new branches in createWidgetLoader, createPreviewConfig, and createVanillaRenderer.
1 parent 1fa8346 commit 87c32b3

6 files changed

Lines changed: 12304 additions & 15697 deletions

File tree

0 commit comments

Comments
 (0)