Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025

Conversation

BrunoQuaresma
Copy link
Collaborator

No description provided.

@BrunoQuaresma BrunoQuaresma requested a review from a team May 24, 2025 19:25
@BrunoQuaresma BrunoQuaresma self-assigned this May 24, 2025
@BrunoQuaresma BrunoQuaresma requested review from Parkreiner and removed request for a team May 24, 2025 19:25
@BrunoQuaresma BrunoQuaresma merged commit afaa20e into main May 27, 2025
35 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/refactor-storybook-decorator branch May 27, 2025 01:39
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2025
@@ -155,3 +161,30 @@ export const withOrganizationSettingsProvider = (Story: FC) => {
</OrganizationSettingsContext.Provider>
);
};

export const withProxyProvider =
(value?: Partial<ProxyContextValue>) => (Story: FC) => {
Copy link
Member

@Parkreiner Parkreiner May 27, 2025

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's Partial 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 undefined
withProxyProvider({ 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

Copy link
Member

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

Copy link
Collaborator Author

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 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants