Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: On demand store #15871

Merged
merged 296 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
296 commits
Select commit Hold shift + click to select a range
ed4076a
Remove logging
tmeasday Aug 13, 2021
0b0111d
Making progress through the tests
tmeasday Aug 13, 2021
dddb811
Merge branch 'on-demand-store' of github.com:storybookjs/storybook in…
shilman Aug 14, 2021
58338c9
Fix undefined story parameters
shilman Aug 14, 2021
77cc48b
Addon-docs: Fix description block
shilman Aug 14, 2021
5c3063c
More WebPreview tests
tmeasday Aug 14, 2021
d738115
Finished docs=>story tests
tmeasday Aug 15, 2021
ad35de6
Completed changing story tests
tmeasday Aug 15, 2021
48e729f
Wrote story change during rendering tests
tmeasday Aug 15, 2021
1ae012d
Finished story=>docs tests
tmeasday Aug 15, 2021
1cd91c8
Added some initial HMR tests
tmeasday Aug 15, 2021
36ab761
Added couple of full stack tests
tmeasday Aug 15, 2021
1d5391c
Split out integration test, added rudimentary docs one
tmeasday Aug 16, 2021
969fbb6
Update validateOptions behaviour and add test
tmeasday Aug 16, 2021
004d93f
Merge branch 'on-demand-store' of github.com:storybookjs/storybook in…
shilman Aug 16, 2021
a036c23
Retain a delta of arg changes on HMR
tmeasday Aug 17, 2021
760e97c
Add a test that arg changes are retained as you browse around
tmeasday Aug 17, 2021
f04c9ca
Updated globals behaviour on HMR to mirror args
tmeasday Aug 17, 2021
3aa4fc8
Ensure we don't keep "spurious" changes on implementation updates
tmeasday Aug 17, 2021
ce7411e
Remove tests that have been ported :+1:
tmeasday Aug 18, 2021
26abe9a
Move tests around selection specifier + HMR over
tmeasday Aug 18, 2021
54a4fd9
Fix linting / compilation problems
tmeasday Aug 18, 2021
5fd3c6f
Repair modules/stories tests
tmeasday Aug 18, 2021
11887b5
Fix WebPreview tests
tmeasday Aug 18, 2021
73cd49b
Fix `enhanceArgTypes`
tmeasday Aug 18, 2021
52acabb
Fix addArgsHelpers test
tmeasday Aug 19, 2021
c9b5453
Official-storybook: Remove template strings (temporary)
shilman Aug 19, 2021
5b44c6b
Official-storybook: Remove design-system (temporary)
shilman Aug 19, 2021
890623c
Move new files from `client-api` => `store`
tmeasday Aug 19, 2021
eb452c6
Official-storybook: Fix main.ts config for on-demand store
shilman Aug 19, 2021
aa6fce5
Moved stuff to webpreview package
tmeasday Aug 19, 2021
5e31fd9
Semi fix/hack client-api/core-client types so they build
tmeasday Aug 19, 2021
50215d2
Need SB Types
tmeasday Aug 19, 2021
2f48a40
Updated all render function to get build working
tmeasday Aug 19, 2021
a543878
Fix up UrlStore + internal types
tmeasday Aug 20, 2021
a9e9a08
Fix up `inferControls`
tmeasday Aug 20, 2021
4064148
Migrate a lot of types in the on-demand-store
tmeasday Aug 23, 2021
18d3633
A lot of type changes, not quite building yet
tmeasday Aug 24, 2021
a1568c3
Types + tests working in store
tmeasday Aug 25, 2021
f083f03
Don't do autotitle any more, get it from stories list
tmeasday Aug 25, 2021
acb5088
Got addon-controls working
tmeasday Aug 25, 2021
56ac92f
Sorted out inferArgTypes
tmeasday Aug 25, 2021
f500ee5
Cleanup
tmeasday Aug 25, 2021
2309e3d
Emit event on config error
tmeasday Aug 26, 2021
e2606f1
Implemented `ClientApi` shim
tmeasday Aug 26, 2021
5b974e9
Got first version of storiesOf shim in. Not yet running
tmeasday Aug 26, 2021
93d1669
Update CSF
tmeasday Aug 27, 2021
d05a6c1
Close to bootstrapping again
tmeasday Aug 27, 2021
a905b09
Got things bootstrappign
tmeasday Aug 27, 2021
5772eb6
Got old-style working
tmeasday Aug 27, 2021
7137e77
Some improvements
tmeasday Aug 28, 2021
6dfe70c
Fixed some problems and added some tests for start.ts
tmeasday Aug 29, 2021
7d3b6b8
Added a test for the combined case
tmeasday Aug 30, 2021
b2a7949
Added `forceReRender` to start
tmeasday Aug 30, 2021
22db095
Clean code up a little
tmeasday Aug 30, 2021
86847d9
Handle HMR in storiesOf
tmeasday Aug 30, 2021
18a6e51
HMR tests for start
tmeasday Aug 30, 2021
dbf9e2f
Added a new feature `storyStoreV7`
tmeasday Aug 30, 2021
5921d52
Maintain component order on HMR
tmeasday Aug 30, 2021
1290b1e
Small cleanups
tmeasday Aug 30, 2021
ac043f9
We need to refetch the story list when the import fn changes
tmeasday Aug 30, 2021
54d3cd0
Implemented .extract() and better getSetStoriesPayload() on store
tmeasday Aug 30, 2021
0df595a
Small type fix
tmeasday Aug 30, 2021
ecf335e
Got getStorybook() going, refactor start + client-api
tmeasday Aug 31, 2021
966a023
Somehow this got lost
tmeasday Aug 31, 2021
e88f66e
Fix type
tmeasday Aug 31, 2021
bee50c8
Add errors for removed APIs
tmeasday Aug 31, 2021
3ee1537
Update decorators to use a common sanitization
tmeasday Aug 31, 2021
c3dfc33
Type finangling
tmeasday Aug 31, 2021
82d2b57
Upgrade CSF again
tmeasday Aug 31, 2021
e1268c7
Clean up some exported APIs
tmeasday Aug 31, 2021
b9c8b87
Don't export `ConfigApi` any more -- not sure it could be used direct…
tmeasday Aug 31, 2021
53ed7b4
Throw from client api exports if using storyStoreV7
tmeasday Aug 31, 2021
2b4996c
Ensure SB globals are always defined
tmeasday Aug 31, 2021
1d91c33
Re-established old addons types
tmeasday Aug 31, 2021
10e6545
Re-add CSF types to addons
tmeasday Aug 31, 2021
a09a531
Fixed up ClientApi types
tmeasday Aug 31, 2021
922e5ee
Update types in core-client
tmeasday Aug 31, 2021
275155f
Got core-client going too
tmeasday Aug 31, 2021
4621153
Cleanup
tmeasday Aug 31, 2021
ec5ddda
More cleanup
tmeasday Aug 31, 2021
3279dbc
Update frameworks to use legacy types
tmeasday Aug 31, 2021
23ee402
Update a bunch of types to get things to 'strap
tmeasday Sep 1, 2021
8dfe9f9
Added a "sync" init path to allow storyshots to be sycn
tmeasday Sep 1, 2021
7168f33
Don't watch a channel just yet in SLS
tmeasday Sep 1, 2021
6f584a2
Fixed up getStorybook/raw and made storyshots work
tmeasday Sep 2, 2021
6b4b753
Lock update
tmeasday Sep 2, 2021
134d4ec
Reverse Story/UnboundStory
tmeasday Sep 2, 2021
9cdd8f8
Update argTypes tests
tmeasday Sep 2, 2021
7bfbe4c
Fix up angular decorators
tmeasday Sep 2, 2021
990d53d
Pass component through angular properly (not on parameters any more)
tmeasday Sep 2, 2021
4508487
Little improvement to `inferArgTypes`
tmeasday Sep 2, 2021
e4236c1
Repair globals/globalTypes in legacy
tmeasday Sep 2, 2021
b75ad58
Temporary work arounds for a couple of angular issues
tmeasday Sep 2, 2021
6a7ddf3
Fix vue+svelte shots
tmeasday Sep 2, 2021
92ef52f
Update snapshot (looks like this one was broken before)
tmeasday Sep 2, 2021
2f50484
Update `yarn.lock`
tmeasday Sep 2, 2021
c062b8a
No need to mock in this test
tmeasday Sep 3, 2021
b8d5b1e
Move inferControls from the controls addon back into the store
tmeasday Sep 3, 2021
a886599
Move inferArgTypes back into the store
tmeasday Sep 3, 2021
dbffe93
Fix angular stories by moving component back into return value
tmeasday Sep 3, 2021
c14d5ef
Set legacy parameters in context for back-compat.
tmeasday Sep 3, 2021
82d186b
Fix addon-docs tests
tmeasday Sep 3, 2021
088ea76
Change `Framework` => `TFramework`
tmeasday Sep 3, 2021
06fdc90
Whoops this was supposed to be optional
tmeasday Sep 3, 2021
b9048d5
Use breaking changes in store/preview tests
tmeasday Sep 3, 2021
f135983
Fix withActions
tmeasday Sep 3, 2021
ec9c4b8
Simplified iframe-webpack.config.js thanks to @ndelangen's feedback
tmeasday Sep 4, 2021
7eaf944
Bring wp4 changes over to wp5
tmeasday Sep 4, 2021
0277d2d
Remove incomplete tests for `to-importFn`
tmeasday Sep 4, 2021
d28587d
Add a note about backcompat
tmeasday Sep 4, 2021
c9e8fc3
Add template to wp5 builder
tmeasday Sep 4, 2021
3e3d2c0
Add a test that `.extract()` filters docs-only
tmeasday Sep 4, 2021
8abc869
Need to pick filenames carefully in configs
tmeasday Sep 4, 2021
9c0a0c2
Added useStoryPrepared() hook
tmeasday Sep 4, 2021
8ec4124
Fix global handling
tmeasday Sep 4, 2021
7929292
Fix stories tests and added some for preparing
tmeasday Sep 4, 2021
3b3d566
Fix ui mockdata
tmeasday Sep 4, 2021
63e2536
Update `prepareStory` tests
tmeasday Sep 5, 2021
a154975
Simplify start tests by turning on breaking v7 changes
tmeasday Sep 5, 2021
e1b4d1a
Update vue snapshots with backcompat parameters
tmeasday Sep 5, 2021
d06b4a6
Ensure user's config is last on the list.
tmeasday Sep 5, 2021
c9b2db4
Updated `caniuse`
tmeasday Sep 5, 2021
afcd33d
Drop unused linting comments
tmeasday Sep 5, 2021
37e7c8f
Add `StoryStore.getStoriesJsonData()`
tmeasday Sep 5, 2021
1567164
Remove a lot of TODOs, clean up
tmeasday Sep 5, 2021
263b005
Don't use title exports in non v7 store
tmeasday Sep 5, 2021
c6b1e5c
Didn't mean to commit this
tmeasday Sep 5, 2021
9eb3afe
Drop a couple FIXMEs that were fixed
tmeasday Sep 6, 2021
67f8827
Deal with multiple `storiesOf` in the same file
tmeasday Sep 6, 2021
f18d3b9
Ensure `render` is used in legacy mode
tmeasday Sep 6, 2021
d31cca3
Move sorting types back to addons
tmeasday Sep 6, 2021
64724a2
Add sorting to back-compat store
tmeasday Sep 6, 2021
816f331
Update extract to wait for init
tmeasday Sep 6, 2021
4232e57
Undo extract change and fix up web-components-kitchen-sink
tmeasday Sep 6, 2021
cc4a16f
Fix incorrect link
tmeasday Sep 6, 2021
eeb3708
Update CSF version to pass Args through to stories
tmeasday Sep 6, 2021
9006d0b
Don't put a `StoryFn` onto `render`
tmeasday Sep 6, 2021
d9bb26e
Various fixes
tmeasday Sep 6, 2021
c2ab7ea
Ensure we deal with cleaning up docs only too
tmeasday Sep 6, 2021
74da384
Don't generate stories.json if we don't have to
tmeasday Sep 6, 2021
013e12e
Re-add client-api to builder-webpack4
tmeasday Sep 6, 2021
f0ae133
Ensure the user (i.e. storyshots) fileName wins
tmeasday Sep 6, 2021
5a75168
No idea why I need to update these angular snapshots
tmeasday Sep 6, 2021
319b1bb
Add store to builder-webpackX deps
tmeasday Sep 6, 2021
474b6c5
Add regenerator to store and web-preview
tmeasday Sep 6, 2021
0f84323
Fix issue with args memory over HMR applying in the wrong place
tmeasday Sep 6, 2021
90d6eac
Ensure we reset args *before* re-rendering
tmeasday Sep 6, 2021
a576375
Remove old comments
tmeasday Sep 6, 2021
d8349ef
Use object freeze to ensure stories are not editable
tmeasday Sep 6, 2021
438e726
Switch `createGate` to a hooks-like syntax
tmeasday Sep 6, 2021
dcf018b
Ensure we handle it if loaders or play throw
tmeasday Sep 6, 2021
d2e713a
Fix old use of "Meta" (=> "Annotation")
tmeasday Sep 6, 2021
1ad369c
Rename GlobalAnnotations => ProjectAnnotations
tmeasday Sep 7, 2021
1fa95a0
Rename `WebPreview` to `PreviewWeb`
tmeasday Sep 7, 2021
4e12e81
Rename `StoriesList` => `StoryIndex`
tmeasday Sep 7, 2021
4c69483
Small fixes to get boostrapping
tmeasday Sep 7, 2021
e61c101
Split ClientApi facade into its own class
tmeasday Sep 7, 2021
7d45c07
Add a "back-compat" API for `__STORYBOOK_CLIENT_API`
tmeasday Sep 7, 2021
1f9e6ad
Cleanup
tmeasday Sep 7, 2021
8d320c2
Deal with initial preview error
tmeasday Sep 7, 2021
306029b
Add async-ness to Story+ArgsTable blocks
tmeasday Sep 7, 2021
c2236da
Update CSF version (projectAnnotations)
tmeasday Sep 7, 2021
6432f6c
Fix bootstrap
tmeasday Sep 7, 2021
5982475
Deepscan cleanups
tmeasday Sep 7, 2021
4884f78
Update snapshots due to WP => PW change
tmeasday Sep 7, 2021
cb1c523
Remove unusued function arg (deepscan)
tmeasday Sep 7, 2021
c449713
Revert "fix(ArgControl): unbox the value to simplify the code"
gaetanmaisse Aug 10, 2021
68b3ef6
Merge remote-tracking branch 'origin/next' into on-demand-store
tmeasday Sep 7, 2021
8276397
Get it bootstrapping again
tmeasday Sep 7, 2021
c2bc484
Update CSF
tmeasday Sep 7, 2021
674e26f
Tweak `ArgTypes`
tmeasday Sep 7, 2021
4702cf0
Fix handlebars dep
tmeasday Sep 7, 2021
a504ad3
Improve types flushed out by CSF changes
tmeasday Sep 7, 2021
08301a3
Fix a bunch of types
tmeasday Sep 7, 2021
f67d9e8
Remove autotitle story from angular
tmeasday Sep 7, 2021
20bc63e
Fix broken `core-server` tests
tmeasday Sep 7, 2021
eb8ea01
Update two angular snapshots
tmeasday Sep 7, 2021
26f83f5
Fix types in a couple of angular tests
tmeasday Sep 7, 2021
d83104c
Remove unused import
tmeasday Sep 7, 2021
b4b59df
Update csf dep in csf-tools
tmeasday Sep 7, 2021
0536851
Switch order of args / argTypes enhancers
tmeasday Sep 7, 2021
b4a75b3
Add getter for `_storyStore` (back compat)
tmeasday Sep 7, 2021
0bb2347
Fix mdx-in-story story
tmeasday Sep 8, 2021
e6698c5
Fix argtypes stories
tmeasday Sep 8, 2021
d2e837a
Fix ember
tmeasday Sep 8, 2021
c24a980
Remove autotitle story from angular SB / fix other
tmeasday Sep 8, 2021
ec23d8c
Ensure we run argTypes enhancers before pulling defaultValues
tmeasday Sep 8, 2021
2325440
Wait a tick before apply arg changes and other re-renders.
tmeasday Sep 8, 2021
abbd38f
Fix globals
tmeasday Sep 8, 2021
2ab56b2
Abort controller fallback for IE
tmeasday Sep 8, 2021
956e131
Update CSF to allow `symbol`
tmeasday Sep 8, 2021
b68f6d3
Ensure we teardown when going to missing properly
tmeasday Sep 8, 2021
b0dda03
Add a note
tmeasday Sep 8, 2021
d586ce7
Don't emit `STORY_PREPARED` in v6 mode.
tmeasday Sep 8, 2021
a6d05f4
Don't allow setting args to `undefined`
tmeasday Sep 8, 2021
c4a2d6a
Ignore v<3 storyIndexes
tmeasday Sep 8, 2021
01294ff
Ensure we send `args` with `SET_STORIES`
tmeasday Sep 8, 2021
fc1b933
Fix storyshots
tmeasday Sep 8, 2021
ec3f41e
Revert "Wait a tick before apply arg changes and other re-renders."
tmeasday Sep 8, 2021
d4d0863
Get rid of setTimeout(0) and instead just call `renderToDOM` immediately
tmeasday Sep 8, 2021
db5cfab
Added a bunch of comments and some READMEs
tmeasday Sep 8, 2021
81838bd
Arg fix `lib/api`
tmeasday Sep 8, 2021
53e00b3
Fix exported type from `.raw()`
tmeasday Sep 8, 2021
d9679bb
Refactor to pass sync as an arg rather than using a separate method
tmeasday Sep 7, 2021
18066d0
Add migration notes about new features
tmeasday Sep 9, 2021
18ed032
Merge pull request #15987 from storybookjs/on-demand-store-sync-arg
tmeasday Sep 9, 2021
b76e744
Temporarily restore glob-base to fix importFn
shilman Sep 10, 2021
5b5524b
Recompute stories.json on each request in dev-mode
shilman Sep 10, 2021
5c83383
Add warning if find old `stories.json`
tmeasday Sep 10, 2021
9473f4d
Apply suggestions from code review
tmeasday Sep 10, 2021
06c58d9
Add presets for all frameworks
tmeasday Sep 11, 2021
66e226e
Somehow missed this
tmeasday Sep 11, 2021
75bad87
Somehow missed this too
tmeasday Sep 11, 2021
0c7a166
Update most <any> to nothing which defaults to <AnyFramework>
tmeasday Sep 11, 2021
ff29a54
Update CSF for `AnyFramework`
tmeasday Sep 11, 2021
a0acacc
Use `to-require-context` for glob generation after all
tmeasday Sep 12, 2021
40a4e6c
Merge pull request #16008 from storybookjs/on-demand-store-uncached-s…
tmeasday Sep 13, 2021
5ecdcce
Merge branch 'on-demand-store' into fix/on-demand-store-addon-docs
shilman Sep 13, 2021
58817de
Fix problem with `prepareForInline`
tmeasday Sep 13, 2021
58db776
Update CSF to get rid of play context
tmeasday Sep 13, 2021
a1e1ec6
Fix docs rendering
shilman Sep 13, 2021
28d1fe2
Merge branch 'on-demand-store' into fix/on-demand-store-addon-docs
shilman Sep 13, 2021
dcdf150
Update store/preview to take project annotations on init.
tmeasday Sep 13, 2021
ca4108c
We need to track initialization now.
tmeasday Sep 13, 2021
2c62434
Fix unbalanced hooks error in ArgsTable
shilman Sep 13, 2021
c76a842
Update Store APIs to be backwards-compatible
tmeasday Sep 13, 2021
ac1b4f5
MDX: Rename mdxComponentMeta to mdxComponentAnnotations
shilman Sep 13, 2021
0ae41ca
Clean up source snippet retrieval for arbitrary stories
shilman Sep 13, 2021
825f435
Fix modern inline rendering with absolutely positioned elements
shilman Sep 13, 2021
5bc3db4
Fix stories.json auto-extraction for named exports
shilman Sep 13, 2021
faf1b42
Retain hooks between loads of the story store.
tmeasday Sep 13, 2021
c26cd6b
Merge branch 'on-demand-store' into fix/on-demand-store-addon-docs
shilman Sep 13, 2021
ebd1f93
Ensure we don't call configure for stories if we don't have any
tmeasday Sep 13, 2021
b385392
Hooks order fix
tmeasday Sep 14, 2021
168e546
Add simple docs tab e2e test
shilman Sep 14, 2021
9070630
Wait until all sub-stories have rendered in docs
tmeasday Sep 14, 2021
6af0547
Update snapshots
shilman Sep 14, 2021
acf0e9c
Fix deepscan error
shilman Sep 14, 2021
9bb98c9
Ensure we emit all `SNIPPET_RENDERED` in `useEffect()`
tmeasday Sep 14, 2021
f2edc58
Fix docs test
shilman Sep 14, 2021
2a16b7a
Update story to new DocsContext
shilman Sep 14, 2021
65be218
Fix tests and ensure channel is defined
tmeasday Sep 14, 2021
c4d2507
Fix failing sourceDecorator tests
shilman Sep 14, 2021
ed17c1f
Merge pull request #16037 from storybookjs/on-demand-store-fix-useEff…
shilman Sep 14, 2021
84603ec
Merge branch 'on-demand-store' into fix/on-demand-store-addon-docs
shilman Sep 14, 2021
adcc98f
E2E force remove package-lock.json
shilman Sep 14, 2021
18f4c71
Addon-docs/web-components: Handle no-manifest version check
shilman Sep 14, 2021
7681f82
Merge pull request #16034 from storybookjs/fix/on-demand-store-addon-…
shilman Sep 14, 2021
5a981b4
Fix deepscan
shilman Sep 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 42 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<h1>Migration</h1>

- [From version 6.3.x to 6.4.0](#from-version-63x-to-640)
- [Story Store v7](#story-store-v7)
- [Babel mode v7](#babel-mode-v7)
- [Loader behavior with args changes](#loader-behaviour-with-args-changes)
- [From version 6.2.x to 6.3.0](#from-version-62x-to-630)
- [Webpack 5 manager build](#webpack-5-manager-build)
- [Angular 12 upgrade](#angular-12-upgrade)
Expand Down Expand Up @@ -166,6 +168,42 @@

## From version 6.3.x to 6.4.0

### Story Store v7

SB6.4 introduces an opt-in feature flag, `features.storyStoreV7`, which loads stories in an "on demand" way (that is when rendered), rather than up front when the Storybook is booted. This way of operating will become the default in 7.0 and will likely be switched to opt-out in that version.

The key benefit of the on demand store is that stories are code-split automatically (in `builder-webpack4` and `builder-webpack5`), which allows for much smaller bundle sizes, faster rendering, and improved general performance via various opt-in Webpack features.

The on-demand store relies on the "story index" data structure which is generated in the server (node) via static code analysis. As such, it has the following limitations:

- Does not work with `storiesOf()`
- Does not work if you used dynamic story names or component titles.

However, the `autoTitle` feature is supported.

#### Behavioral differences

The key behavioral differences of the v7 store are:

- `SET_STORIES` is not emitted on boot up. Instead the manager loads the story index independenly.
- A new event `STORY_PREPARED` is emitted when a story is rendered for the first time, which contains metadata about the story, such as `parameters`.
- All "entire" store APIs such as `extract()` need to be proceeded by an async call to `loadAllCSFFiles()` which fetches all CSF files and processes them.

#### Using the v7 store

To activate the v7 mode set the feature flag in your `.storybook/main.js` config:

```js
module.exports = {
// ... your existing config
features: {
storyStoreV7: true,
},
};
```

NOTE: `features.storyStoreV7` implies `features.buildStoriesJson` and has the same limitations.

### Babel mode v7

SB6.4 introduces an opt-in feature flag, `features.babelModeV7`, that reworks the way Babel is configured in Storybook to make it more consistent with the Babel is configured in your app. This breaking change will become the default in SB 7.0, but we encourage you to migrate today.
Expand Down Expand Up @@ -197,6 +235,10 @@ npx sb@next babelrc

This will create a `.babelrc.json` file. This file includes a bunch of babel plugins, so you may need to add new package devDependencies accordingly.

### Loader behavior with args changes

In 6.4 the behavior of loaders when arg changes occurred was tweaked so loaders do not re-run. Instead the previous value of the loader in passed to the story, irrespective of the new args.

## From version 6.2.x to 6.3.0

### Webpack 5 manager build
Expand Down
2 changes: 1 addition & 1 deletion addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"@storybook/addons": "6.4.0-alpha.34",
"@storybook/api": "6.4.0-alpha.34",
"@storybook/channels": "6.4.0-alpha.34",
"@storybook/client-api": "6.4.0-alpha.34",
"@storybook/client-logger": "6.4.0-alpha.34",
"@storybook/components": "6.4.0-alpha.34",
"@storybook/core-events": "6.4.0-alpha.34",
"@storybook/csf": "0.0.2--canary.68887a1.0",
"@storybook/theming": "6.4.0-alpha.34",
"axe-core": "^4.2.0",
"core-js": "^3.8.2",
Expand Down
4 changes: 2 additions & 2 deletions addons/a11y/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DecoratorFunction } from '@storybook/addons';
import { AnyFramework, DecoratorFunction } from '@storybook/csf';
import deprecate from 'util-deprecate';
import dedent from 'ts-dedent';

Expand All @@ -9,7 +9,7 @@ if (module && module.hot && module.hot.decline) {
module.hot.decline();
}

export const withA11y: DecoratorFunction = deprecate(
export const withA11y: DecoratorFunction<AnyFramework> = deprecate(
(storyFn, storyContext) => {
return storyFn(storyContext);
},
Expand Down
2 changes: 1 addition & 1 deletion addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"dependencies": {
"@storybook/addons": "6.4.0-alpha.34",
"@storybook/api": "6.4.0-alpha.34",
"@storybook/client-api": "6.4.0-alpha.34",
"@storybook/components": "6.4.0-alpha.34",
"@storybook/core-events": "6.4.0-alpha.34",
"@storybook/csf": "0.0.2--canary.68887a1.0",
"@storybook/theming": "6.4.0-alpha.34",
"core-js": "^3.8.2",
"fast-deep-equal": "^3.1.3",
Expand Down
24 changes: 14 additions & 10 deletions addons/actions/src/preset/addArgsHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('actions parameter enhancers', () => {

it('should add actions that match a pattern', () => {
const args = inferActionsFromArgTypesRegex(({
args: {},
initialArgs: {},
argTypes,
parameters,
} as unknown) as StoryContext);
Expand All @@ -20,7 +20,7 @@ describe('actions parameter enhancers', () => {

it('should NOT override pre-existing args', () => {
const args = inferActionsFromArgTypesRegex(({
args: { onClick: 'pre-existing value' },
initialArgs: { onClick: 'pre-existing value' },
argTypes,
parameters,
} as unknown) as StoryContext);
Expand All @@ -29,7 +29,7 @@ describe('actions parameter enhancers', () => {

it('should NOT override pre-existing args, if null', () => {
const args = inferActionsFromArgTypesRegex(({
args: { onClick: null },
initialArgs: { onClick: null },
argTypes,
parameters,
} as unknown) as StoryContext);
Expand All @@ -38,7 +38,7 @@ describe('actions parameter enhancers', () => {

it('should override pre-existing args, if undefined', () => {
const args = inferActionsFromArgTypesRegex(({
args: { onClick: undefined },
initialArgs: { onClick: undefined },
argTypes,
parameters,
} as unknown) as StoryContext);
Expand All @@ -47,7 +47,7 @@ describe('actions parameter enhancers', () => {

it('should do nothing if actions are disabled', () => {
const args = inferActionsFromArgTypesRegex(({
args: {},
initialArgs: {},
argTypes,
parameters: {
...parameters,
Expand All @@ -65,7 +65,11 @@ describe('actions parameter enhancers', () => {
};
it('should add actions based on action.args', () => {
expect(
addActionsFromArgTypes(({ args: {}, argTypes, parameters: {} } as unknown) as StoryContext)
addActionsFromArgTypes(({
initialArgs: {},
argTypes,
parameters: {},
} as unknown) as StoryContext)
).toEqual({
onClick: expect.any(Function),
onBlur: expect.any(Function),
Expand All @@ -76,7 +80,7 @@ describe('actions parameter enhancers', () => {
expect(
addActionsFromArgTypes(({
argTypes: { onClick: { action: 'clicked!' } },
args: { onClick: 'pre-existing value' },
initialArgs: { onClick: 'pre-existing value' },
parameters: {},
} as unknown) as StoryContext)
).toEqual({});
Expand All @@ -86,7 +90,7 @@ describe('actions parameter enhancers', () => {
expect(
addActionsFromArgTypes(({
argTypes: { onClick: { action: 'clicked!' } },
args: { onClick: null },
initialArgs: { onClick: null },
parameters: {},
} as unknown) as StoryContext)
).toEqual({});
Expand All @@ -96,7 +100,7 @@ describe('actions parameter enhancers', () => {
expect(
addActionsFromArgTypes(({
argTypes: { onClick: { action: 'clicked!' } },
args: { onClick: undefined },
initialArgs: { onClick: undefined },
parameters: {},
} as unknown) as StoryContext)
).toEqual({ onClick: expect.any(Function) });
Expand All @@ -105,7 +109,7 @@ describe('actions parameter enhancers', () => {
it('should do nothing if actions are disabled', () => {
expect(
addActionsFromArgTypes(({
args: {},
initialArgs: {},
argTypes,
parameters: { actions: { disable: true } },
} as unknown) as StoryContext)
Expand Down
14 changes: 7 additions & 7 deletions addons/actions/src/preset/addArgsHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Args } from '@storybook/addons';
import { ArgsEnhancer } from '@storybook/client-api';
import { AnyFramework, ArgsEnhancer } from '@storybook/csf';
import { action } from '../index';

// interface ActionsParameter {
Expand All @@ -12,9 +12,9 @@ import { action } from '../index';
* matches a regex, such as `^on.*` for react-style `onClick` etc.
*/

export const inferActionsFromArgTypesRegex: ArgsEnhancer = (context) => {
export const inferActionsFromArgTypesRegex: ArgsEnhancer<AnyFramework> = (context) => {
const {
args,
initialArgs,
argTypes,
parameters: { actions },
} = context;
Expand All @@ -28,7 +28,7 @@ export const inferActionsFromArgTypesRegex: ArgsEnhancer = (context) => {
);

return argTypesMatchingRegex.reduce((acc, [name, argType]) => {
if (typeof args[name] === 'undefined') {
if (typeof initialArgs[name] === 'undefined') {
acc[name] = action(name);
}
return acc;
Expand All @@ -38,9 +38,9 @@ export const inferActionsFromArgTypesRegex: ArgsEnhancer = (context) => {
/**
* Add action args for list of strings.
*/
export const addActionsFromArgTypes: ArgsEnhancer = (context) => {
export const addActionsFromArgTypes: ArgsEnhancer<AnyFramework> = (context) => {
const {
args,
initialArgs,
argTypes,
parameters: { actions },
} = context;
Expand All @@ -51,7 +51,7 @@ export const addActionsFromArgTypes: ArgsEnhancer = (context) => {
const argTypesWithAction = Object.entries(argTypes).filter(([name, argType]) => !!argType.action);

return argTypesWithAction.reduce((acc, [name, argType]) => {
if (typeof args[name] === 'undefined') {
if (typeof initialArgs[name] === 'undefined') {
acc[name] = action(typeof argType.action === 'string' ? argType.action : name);
}
return acc;
Expand Down
3 changes: 1 addition & 2 deletions addons/actions/src/preview/withActions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Based on http://backbonejs.org/docs/backbone.html#section-164
import global from 'global';
import { useEffect } from '@storybook/client-api';
import { useEffect, makeDecorator } from '@storybook/addons';
import deprecate from 'util-deprecate';
import dedent from 'ts-dedent';

import { makeDecorator } from '@storybook/addons';
import { actions } from './actions';

import { PARAM_KEY } from '../constants';
Expand Down
1 change: 1 addition & 0 deletions addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@storybook/client-logger": "6.4.0-alpha.34",
"@storybook/components": "6.4.0-alpha.34",
"@storybook/core-events": "6.4.0-alpha.34",
"@storybook/csf": "0.0.2--canary.68887a1.0",
"@storybook/theming": "6.4.0-alpha.34",
"core-js": "^3.8.2",
"global": "^4.4.0",
Expand Down
8 changes: 6 additions & 2 deletions addons/backgrounds/src/decorators/withBackground.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StoryFn as StoryFunction, StoryContext, useMemo, useEffect } from '@storybook/addons';
import { useMemo, useEffect } from '@storybook/addons';
import { AnyFramework, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/csf';

import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
import {
Expand All @@ -8,7 +9,10 @@ import {
isReduceMotionEnabled,
} from '../helpers';

export const withBackground = (StoryFn: StoryFunction, context: StoryContext) => {
export const withBackground = (
StoryFn: StoryFunction<AnyFramework>,
context: StoryContext<AnyFramework>
) => {
const { globals, parameters } = context;
const globalsBackgroundColor = globals[BACKGROUNDS_PARAM_KEY]?.value;
const backgroundsConfig = parameters[BACKGROUNDS_PARAM_KEY];
Expand Down
8 changes: 6 additions & 2 deletions addons/backgrounds/src/decorators/withGrid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dedent from 'ts-dedent';
import deprecate from 'util-deprecate';
import { StoryFn as StoryFunction, StoryContext, useMemo, useEffect } from '@storybook/addons';
import { useMemo, useEffect } from '@storybook/addons';
import { AnyFramework, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/csf';

import { clearStyles, addGridStyle } from '../helpers';
import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
Expand All @@ -15,7 +16,10 @@ const deprecatedCellSizeWarning = deprecate(
`
);

export const withGrid = (StoryFn: StoryFunction, context: StoryContext) => {
export const withGrid = (
StoryFn: StoryFunction<AnyFramework>,
context: StoryContext<AnyFramework>
) => {
const { globals, parameters } = context;
const gridParameters = parameters[BACKGROUNDS_PARAM_KEY].grid;
const isActive = globals[BACKGROUNDS_PARAM_KEY]?.grid === true && gridParameters.disable !== true;
Expand Down
5 changes: 4 additions & 1 deletion addons/controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@
"dependencies": {
"@storybook/addons": "6.4.0-alpha.34",
"@storybook/api": "6.4.0-alpha.34",
"@storybook/client-api": "6.4.0-alpha.34",
"@storybook/client-logger": "6.4.0-alpha.34",
"@storybook/components": "6.4.0-alpha.34",
"@storybook/csf": "0.0.2--canary.68887a1.0",
"@storybook/node-logger": "6.4.0-alpha.34",
"@storybook/store": "6.4.0-alpha.34",
"@storybook/theming": "6.4.0-alpha.34",
"core-js": "^3.8.2",
"lodash": "^4.17.20",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see Lodash being used anywhere.

"ts-dedent": "^2.0.0"
},
"peerDependencies": {
Expand Down
13 changes: 12 additions & 1 deletion addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@
"@storybook/components": "6.4.0-alpha.34",
"@storybook/core": "6.4.0-alpha.34",
"@storybook/core-events": "6.4.0-alpha.34",
"@storybook/csf": "0.0.1",
"@storybook/csf": "0.0.2--canary.68887a1.0",
"@storybook/csf-tools": "6.4.0-alpha.34",
"@storybook/node-logger": "6.4.0-alpha.34",
"@storybook/postinstall": "6.4.0-alpha.34",
"@storybook/preview-web": "6.4.0-alpha.34",
"@storybook/source-loader": "6.4.0-alpha.34",
"@storybook/store": "6.4.0-alpha.34",
"@storybook/theming": "6.4.0-alpha.34",
"acorn": "^7.4.1",
"acorn-jsx": "^5.3.1",
Expand Down Expand Up @@ -106,6 +108,7 @@
"@emotion/core": "^10.1.1",
"@emotion/styled": "^10.0.27",
"@storybook/angular": "6.4.0-alpha.34",
"@storybook/html": "6.4.0-alpha.34",
"@storybook/react": "6.4.0-alpha.34",
"@storybook/vue": "6.4.0-alpha.34",
"@storybook/web-components": "6.4.0-alpha.34",
Expand Down Expand Up @@ -139,6 +142,8 @@
},
"peerDependencies": {
"@storybook/angular": "6.4.0-alpha.34",
"@storybook/html": "6.4.0-alpha.34",
"@storybook/react": "6.4.0-alpha.34",
"@storybook/vue": "6.4.0-alpha.34",
"@storybook/vue3": "6.4.0-alpha.34",
"@storybook/web-components": "6.4.0-alpha.34",
Expand All @@ -155,6 +160,12 @@
"@storybook/angular": {
"optional": true
},
"@storybook/html": {
"optional": true
},
"@storybook/react": {
"optional": true
},
"@storybook/vue": {
"optional": true
},
Expand Down
Loading