Skip to content

Commit

Permalink
fix: useFetch hydration mismatches (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hebilicious committed Aug 10, 2023
1 parent 7243ba1 commit 3a541cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/form-actions-nuxt/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
README.md
README.md
*.tgz
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getLoaderUrl = (loader: Loader) => validLoaderName(loader) ? getLoa
*/
export async function useLoader<Name extends LoaderName>(loader?: Name | undefined | false, loaderOptions?: LoaderOptions) {
const fetchNuxtLoader: FetchNuxtLoaderFunction<Name> = async (url: string, loaderOptions?: LoaderOptions) => {
const { data: result, refresh, pending, error } = await useFetch(url, { immediate: true, params: useRoute().params, ...loaderOptions })
const { data: result, refresh, pending, error } = await useFetch(url, { key: url, immediate: true, params: useRoute().params, ...loaderOptions })
return { result, refresh, pending, error } // Because we're forcing the return, we get a static type here.
}

Expand Down

0 comments on commit 3a541cb

Please sign in to comment.