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

Prefer type inference from options#getFreshValue over reporter #93

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

Xiphe
Copy link
Collaborator

@Xiphe Xiphe commented Feb 5, 2024

This fixes an issue where the unknown Value type of some reporters has been infered by cachified thereby ignoring the much more useful return type of getFreshValue

fix #70

BREAKING CHANGE:
CachifiedOptions#reporter has been removed in favor of passing a reporter as second argument to cachified

MIGRATION:
Change cachified({ reporter: myReporter /* ... */ }) to cachified({ /* ... */ }, myReporter)

…orter

this fixes an issue where the `unknown` Value type of some reporters has been infered by cachified
thereby ignoring the much more useful return type of `getFreshValue`

fix #70

BREAKING CHANGE:
`CachifiedOptions#reporter` has been removed in favor of passing a reporter as second argument to cachified

MIGRATION:
Change `cachified({ reporter: myReporter /* ... */ })` to `cachified({ /* ... */ }, myReporter)`
@Xiphe Xiphe requested a review from kentcdodds February 5, 2024 12:20
@@ -57,7 +57,6 @@ export async function getCachedValue<Value>(
report({ name: 'refreshValueStart' });
void cachified({
...context,
reporter: () => () => {},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This existed to silence reporting for background refreshes. Not needed anymore since reporter isn't part of context anymore.

@kentcdodds kentcdodds changed the base branch from main to next February 9, 2024 19:22
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thank you for doing this!

@kentcdodds kentcdodds merged commit b4831fe into next Feb 9, 2024
5 checks passed
@kentcdodds kentcdodds deleted the fix-reporter-type-inference branch February 9, 2024 19:24
Copy link

github-actions bot commented Feb 9, 2024

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Adding a reporter changes return type of getFreshValue to unknown
2 participants