- Notifications
You must be signed in to change notification settings - Fork905
chore: add proxy provider decorator for storybook#18023
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
afaa20e
intomainUh oh!
There was an error while loading.Please reload this page.
@@ -155,3 +161,30 @@ export const withOrganizationSettingsProvider = (Story: FC) => { | |||
</OrganizationSettingsContext.Provider> | |||
); | |||
}; | |||
export const withProxyProvider = | |||
(value?: Partial<ProxyContextValue>) => (Story: FC) => { |
ParkreinerMay 27, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Oh, there might be a slight bug risk here. TypeScript'sPartial
type not only makes the keys for an object optional, but also the values for each key. So someone could accidentally do this:
// Every single property in the value input can be set to undefinedwithProxyProvider({setProxy:undefined})
Obviously not a huge deal when you're placing literal values, but if we have any derived values that could be optionally undefined, having the...value
at the end would mean that some fields would get wiped when we don't want them to be
Especially because this is a test utility that's used throughout several other files, I'd rather we go through the trouble of stitching the objects together manually, so that we have more peace of mind
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.
If you're okay with it, I can make a quick patch PR
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.
Hm.. I see. Feel free to patch 🙏
No description provided.