[Bug]: Creating stories from Controls fails in Svelte CSF with SyntaxError: Unexpected token, expected "}"
#240
Labels
bug
Something isn't working
Describe the bug
When viewing a story written in Svelte CSF, editing controls and pressing "Save", the UI shows
did not save, unknown error
, and the terminal shows an error.This is because the editing logic of controls doesn't support Svelte CSF, only regular CSF, which is a completely different format, language even.
Steps to reproduce the behavior
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots and/or logs
Error in terminal:
Additional context
At the moment it's not feasible to implement Svelte CSF support in Create from Controls. The feature works by modifying the AST, and given it's a completely different AST, the logic would have to be completely different. It might even be impossible at the current stage, given the only tool that allows you to print a Svelte AST to source is
svelte-ast-print
which lacks features such as TypeScript support.We should instead disable the feature from the addon. That is done by setting a specific parameter, and the addon can set that parameter for all stories it touches, so it wouldn't affect stories written in regular CSF:
https://storybook.js.org/docs/essentials/controls#disablesavefromui
Originally reported at sveltejs/cli#339
The text was updated successfully, but these errors were encountered: