-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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: Add untilEvent
and toChannelEvent
to UniversalStore
#30709
base: next
Are you sure you want to change the base?
Conversation
…bookjs/storybook into jeppe/universal-store-improvements
View your CI Pipeline Execution ↗ for commit f380eca.
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR enhances the UniversalStore with two new methods – untilEvent and toChannelEvent – and updates documentation and unit tests accordingly.
- Added untilEvent to wait for one or two events with resolve/reject behavior
- Implemented toChannelEvent to convert store events for direct channel communication
- Updated unit tests and the mock store to reflect these new methods
Reviewed Changes
File | Description |
---|---|
code/core/src/shared/universal-store/index.test.ts | Adds unit tests for untilEvent and toChannelEvent methods |
code/core/src/shared/universal-store/index.ts | Adds documentation examples and implementations for new methods |
code/core/src/shared/universal-store/mock.ts | Updates mocks to include the new untilEvent and toChannelEvent methods |
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
Before | After | Difference | |
---|---|---|---|
Dependency count | 52 | 52 | 0 |
Self size | 19.41 MB | 19.46 MB | 🚨 +46 KB 🚨 |
Dependency size | 14.26 MB | 14.26 MB | 0 B |
Bundle Size Analyzer | Link | Link |
sb
Before | After | Difference | |
---|---|---|---|
Dependency count | 53 | 53 | 0 |
Self size | 1 KB | 1 KB | 0 B |
Dependency size | 33.67 MB | 33.72 MB | 🚨 +46 KB 🚨 |
Bundle Size Analyzer | Link | Link |
@storybook/cli
Before | After | Difference | |
---|---|---|---|
Dependency count | 357 | 357 | 0 |
Self size | 278 KB | 278 KB | 0 B |
Dependency size | 84.15 MB | 84.20 MB | 🚨 +47 KB 🚨 |
Bundle Size Analyzer | Link | Link |
@storybook/codemod
Before | After | Difference | |
---|---|---|---|
Dependency count | 275 | 275 | 0 |
Self size | 617 KB | 617 KB | 0 B |
Dependency size | 65.74 MB | 65.79 MB | 🚨 +47 KB 🚨 |
Bundle Size Analyzer | Link | Link |
What I did
This PR adds two methods to the UniversalStore, in anticipation of their needs later:
untilEvent
- wait for an event to fire once, or optionally also another event that rejects the promise insteadtoChannelEvent
- converts a universal store event to a raw channel event that can be sent directly on the channel when necessary.Also added usage examples to all methods in JSDocs
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
I'll provide a concise review of the PR that adds
untilEvent
andtoChannelEvent
methods to the UniversalStore class.This PR enhances the UniversalStore with two new utility methods that improve event handling and channel communication capabilities.
untilEvent
method to UniversalStore that returns a Promise resolving when a specific event occurs, with optional rejection on another eventtoChannelEvent
method to convert store events to raw channel events for direct channel emissionThe implementation is well-typed and follows the existing patterns in the codebase, making it a solid addition to the UniversalStore API.
Greptile AI: Universal Store event handling improvements