Skip to content

Commit c73c275

Browse files
committed
Another storybook fix.
1 parent 08251b0 commit c73c275

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Clipboard copy button for [SuperDebug](https://superforms.rocks/super-debug). Also fixed height when collapsed without label.
1313

14+
### Fixed
15+
16+
- Storybook fix for missing `page` store.
17+
1418
## [2.8.0] - 2024-03-05
1519

1620
### Added

src/lib/client/superForm.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export function superForm<
454454

455455
// Check multiple id's
456456
const _initialFormId = options.id ?? form.id;
457-
const _currentPage = get(page);
457+
const _currentPage = get(page) ?? (STORYBOOK_MODE ? {} : undefined);
458458

459459
if (browser && options.warnings?.duplicateId !== false) {
460460
if (!formIds.has(_currentPage)) {
@@ -1319,6 +1319,9 @@ export function superForm<
13191319
// Need to subscribe to catch page invalidation.
13201320
Unsubscriptions_add(
13211321
page.subscribe(async (pageUpdate) => {
1322+
if (STORYBOOK_MODE && pageUpdate === undefined) {
1323+
pageUpdate = { status: 200 } as Page;
1324+
}
13221325
const successResult = pageUpdate.status >= 200 && pageUpdate.status < 300;
13231326

13241327
if (options.applyAction && pageUpdate.form && typeof pageUpdate.form === 'object') {

0 commit comments

Comments
 (0)