Skip to content

Commit

Permalink
add readme section about legacy api support
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Sep 5, 2024
1 parent 2468f04 commit e5793d1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ERRORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ It cannot be a shorthand or a dynamic value.
You are using legacy template API, with deprecated components.\
To enable support for legacy API, tweak this addon options in your _(`./.storybook/main.(j|t)s`)_ file:

See [the Legacy API section](./README.md#legacy-api) for more details.

```diff
addons: [
// ... other addons
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,31 @@ If you need to customize the type of the `args`, you can pass in a generic type
const { Story } = defineMeta<{ anotherProp: boolean }>( ... );
```

### Legacy API

Version 5 of the addon changes the API from v4 in key areas, as described above. However a feature flag has been introduced to maintain support for the `<Template>`-based legacy API as it was prior to v5.

To enable supoprt for the legacy API, make the following change to your main Storybook config:

```diff
export default {
addons: [
- '@storybook/addon-svelte-csf',
+ {
+ name: '@storybook/addon-svelte-csf',
+ options: {
+ legacyTemplate: true
+ },
...
],
...
}
```

This can make the overall experience slower, because it adds more transformation steps on top of the existing ones. It should only be used temporarily while migrating to the new API. It's highly likely that the legacy support will be dropped in future major versions of the addon.

The legacy support is not bullet-proof, and it might not work in all scenarios that previously worked. If you're experiencing issues or getting errors after upgrading to v5, try migrating the problematic stories files to the modern API.

## Version compatibility

### latest
Expand Down

0 comments on commit e5793d1

Please sign in to comment.