Skip to content

Commit 3d64dc6

Browse files
authored
docs(react-query): ensure suspense example fallback renders correctly (#9119)
The previous suspense example incorrectly rendered null instead of the fallback UI. This change moves the null check outside the Suspense component to ensure the fallback is displayed as expected. Fixes #9019
1 parent 66ea5f2 commit 3d64dc6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/react/suspense/src/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ function Example() {
7070
)}
7171
onReset={reset}
7272
>
73-
<React.Suspense fallback={<h1>Loading projects...</h1>}>
74-
{showProjects ? (
75-
activeProject ? (
73+
{showProjects ? (
74+
<React.Suspense fallback={<h1>Loading projects...</h1>}>
75+
{activeProject ? (
7676
<Project
7777
activeProject={activeProject}
7878
setActiveProject={setActiveProject}
7979
/>
8080
) : (
8181
<Projects setActiveProject={setActiveProject} />
82-
)
83-
) : null}
84-
</React.Suspense>
82+
)}
83+
</React.Suspense>
84+
) : null}
8585
</ErrorBoundary>
8686
)}
8787
</QueryErrorResetBoundary>

0 commit comments

Comments
 (0)