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

feat!: port upstream useLazyFetch #1137

Merged
merged 1 commit into from
Mar 21, 2024
Merged

Conversation

wattanx
Copy link
Collaborator

@wattanx wattanx commented Mar 8, 2024

πŸ”— Linked issue

Some issues can be resolved by porting.

Fixes: #1135

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Port useLazyFetch from nuxt upstream.
fetchDefaults is not supported at this time.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@wattanx wattanx changed the title feat!: port upstream useFetch, useLazyFetch feat!: port upstream useLazyFetch Mar 8, 2024
Comment on lines +222 to +230
type MaybeRef<T> = T | Ref<T>
type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T)
type AnyFn = (...args: any[]) => any

function toValue<T> (r: MaybeRefOrGetter<T>): T {
return typeof r === 'function'
? (r as AnyFn)()
: unref(r)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because Vue 2 does not support toValue, we implemented the equivalent of toValue in vueuse
https://github.com/vueuse/vueuse/blob/main/packages/shared/toValue/index.ts

@wattanx wattanx marked this pull request as ready for review March 20, 2024 07:26
@wattanx wattanx force-pushed the feat/port-upstream-uselazyfetch branch from d31a8a8 to 2c2e693 Compare March 20, 2024 07:26
@wattanx wattanx requested a review from danielroe March 20, 2024 07:40
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

πŸ”₯

@danielroe danielroe merged commit f63a7c5 into main Mar 21, 2024
57 checks passed
@danielroe danielroe deleted the feat/port-upstream-uselazyfetch branch March 21, 2024 16:24
@github-actions github-actions bot mentioned this pull request Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useLazyFetch does not work with reactive values
2 participants