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

Brand memoized args from React.useMemo #2822

Open
zzmp opened this issue Nov 18, 2021 · 0 comments
Open

Brand memoized args from React.useMemo #2822

zzmp opened this issue Nov 18, 2021 · 0 comments
Labels
improvement Improves the ux performance refactor Improves code architecture

Comments

@zzmp
Copy link
Contributor

zzmp commented Nov 18, 2021

Is your feature request related to a problem? Please describe.
Certain functions, like multicall, will only be performant when memoized. This can currently only be caught in code reviews (eg #2806).

Describe the solution you'd like
useMemo should be retyped to return a branded type, and useSingleCallResult should enforce (via typing) that passed arguments are memoized.

Describe alternatives you've considered
N/A

Additional context
Example tutorial of branding (like branding a cow, not like a company's brand): https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d

@zzmp zzmp added improvement Improves the ux performance refactor Improves code architecture labels Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves the ux performance refactor Improves code architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant