Skip to content

Commit

Permalink
Merge pull request #200 from atomic-state/feats/suspense
Browse files Browse the repository at this point in the history
Feats/suspense
  • Loading branch information
danybeltran authored Dec 7, 2024
2 parents becbbdb + 05d9734 commit 51d55f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "http-react",
"version": "3.7.0",
"version": "3.7.2",
"description": "React hooks for data fetching",
"main": "dist/index.js",
"scripts": {
Expand Down
19 changes: 10 additions & 9 deletions src/hooks/use-fetch.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
'use client'
import {
useState,
useEffect,
useMemo,
useRef,
useCallback,
useLayoutEffect
} from 'react'
import { useState, useEffect, useMemo, useRef, useCallback } from 'react'

import {
abortControllers,
Expand Down Expand Up @@ -1396,7 +1389,15 @@ export function useFetch<FetchDataType = any, BodyType = any>(

if (!hasInitialOrFallbackData) {
throw new Error(
`Request with id "${id}" uses suspense but no SSF fallback data was provided. See https://httpr.vercel.app/docs/fetch_config/defaults`
`Request with id "${id}" uses suspense but no fallback data was provided for SSR. See https://httpr.vercel.app/docs/fetch_config/defaults.
If you want to use suspense without fallback data, wrap with the <Suspense> component from 'http-react', which renders <React.Suspense> client-side and the fallback ui server-side:
import { Suspense } from "http-react"
Learn more: https://httpr.vercel.app/docs/api#suspense
`
)
}
}
Expand Down

0 comments on commit 51d55f1

Please sign in to comment.