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

docs(solid-query): add optional chaining to prevent suspense bug #7709

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/framework/solid/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SolidJS has been gaining popularity as a fast, reactive, and declarative library

```tsx
import { createResource, ErrorBoundary, Suspense } from 'solid-js'
import { render } from 'solid-js/web'

function App() {
const [repository] = createResource(async () => {
Expand All @@ -26,7 +27,7 @@ function App() {
<ErrorBoundary fallback={<div>Something went wrong!</div>}>
{/* Suspense will trigger a loading state while the data is being fetched */}
<Suspense fallback={<div>Loading...</div>}>
<div>{repository().updated_at}</div>
<div>{repository()?.updated_at}</div>
</Suspense>
</ErrorBoundary>
</div>
Expand Down Expand Up @@ -100,7 +101,7 @@ function App() {
The `data` property on a query is a SolidJS resource
so it will work with Suspense and transitions out of the box!
*/}
<div>{repositoryQuery.data.updated_at}</div>
<div>{repositoryQuery.data?.updated_at}</div>
</Suspense>
</ErrorBoundary>
</div>
Expand Down
Loading