Skip to content

[Bug] When calling the fn "superForm" from "sveltekit-superforms/client" we get error "Cannot destructure property 'story' of 'storyObject' as it is undefined." #170

Open
@alexbjorlig

Description

@alexbjorlig

Describe the bug

I'm trying to write a story, and using sveltekit-superforms.

When calling the function superForm from import { superForm } from 'sveltekit-superforms/client'; I get the error:

TypeError: Cannot destructure property 'story' of 'storyObject' as it is undefined.
    at normalizeStory (http://localhost:6006/sb-preview/runtime.js:38:260)
    at http://localhost:6006/sb-preview/runtime.js:41:400
    at Array.forEach (<anonymous>)
    at processCSFFile (http://localhost:6006/sb-preview/runtime.js:41:354)
    at StoryStore.memoizerific [as processCSFFileWithCache] (http://localhost:6006/sb-preview/runtime.js:1:4751)
    at http://localhost:6006/sb-preview/runtime.js:47:8515
    at async StoryStore.loadStory (http://localhost:6006/sb-preview/runtime.js:47:9920)
    at async http://localhost:6006/sb-preview/runtime.js:81:9005
    at async StoryRender.runPhase (http://localhost:6006/sb-preview/runtime.js:81:8766)
    at async StoryRender.prepare (http://localhost:6006/sb-preview/runtime.js:81:8924)

Steps to reproduce the behavior

  1. Go to this repo, clone, and npm install
  2. Open the Button.stories.svelte in storybook
  3. See error

Expected behavior

No error.

Screenshots and/or logs

CleanShot 2024-01-30 at 19 41 02@2x

Environment

Storybook Environment Info:

  System:
    OS: macOS 14.3
    CPU: (8) arm64 Apple M2
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    npm: 10.3.0 - ~/.nvm/versions/node/v18.17.1/bin/npm <----- active
  Browsers:
    Chrome: 121.0.6167.85
    Safari: 17.3
  npmPackages:
    @storybook/addon-essentials: ^7.6.11 => 7.6.11 
    @storybook/addon-interactions: ^7.6.11 => 7.6.11 
    @storybook/addon-links: ^7.6.11 => 7.6.11 
    @storybook/addon-svelte-csf: ^4.1.0 => 4.1.0 
    @storybook/blocks: ^7.6.11 => 7.6.11 
    @storybook/svelte: ^7.6.11 => 7.6.11 
    @storybook/sveltekit: ^7.6.11 => 7.6.11 
    @storybook/test: ^7.6.11 => 7.6.11 
    eslint-plugin-storybook: ^0.6.15 => 0.6.15 
    storybook: ^7.6.11 => 7.6.11

Additional context

I'm unsure if we are strictly speaking about a bug in Addon-svelte-csf, or if this has something to do with Superforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    legacyRelated to the legacy version(s)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions