Skip to content

Commit

Permalink
docs(suspensive.org): resolve indent lint
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Nov 24, 2024
1 parent 9bca0a1 commit e3eace0
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions docs/suspensive.org/src/pages/en/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,36 @@ In this case, you can check `isLoading` and `isError` to handle loading and erro

```jsx ! Page.jsx
const Page = () => {
const userQuery = useQuery(userQueryOptions())
const postsQuery = useQuery({
...postsQueryOptions();
select: (posts) => posts.filter(({ isPublic }) => isPublic),
})
const promotionsQuery = useQuery(promotionsQueryOptions())

if (
userQuery.isLoading ||
postsQuery.isLoading ||
promotionsQuery.isLoading
) {
return 'loading...'
}

if (userQuery.isError || postsQuery.isError || promotionsQuery.isError) {
return 'error'
}

return (
<Fragment>
<UserProfile {...userQuery.data} />
{postsQuery.data.map((post) => (
<PostListItem key={post.id} {...post} />
))}
{promotionsQuery.data.map((promotion) => (
<Promotion key={promotion.id} {...promotion} />
))}
</Fragment>
)
const userQuery = useQuery(userQueryOptions())
const postsQuery = useQuery({
...postsQueryOptions(),
select: (posts) => posts.filter(({ isPublic }) => isPublic),
})
const promotionsQuery = useQuery(promotionsQueryOptions())

if (
userQuery.isLoading ||
postsQuery.isLoading ||
promotionsQuery.isLoading
) {
return 'loading...'
}

if (userQuery.isError || postsQuery.isError || promotionsQuery.isError) {
return 'error'
}

return (
<Fragment>
<UserProfile {...userQuery.data} />
{postsQuery.data.map((post) => (
<PostListItem key={post.id} {...post} />
))}
{promotionsQuery.data.map((promotion) => (
<Promotion key={promotion.id} {...promotion} />
))}
</Fragment>
)
}
```

Expand Down Expand Up @@ -113,33 +113,33 @@ However, since `useSuspenseQuery` is a hook, the component must be separated to

```jsx ! Page.jsx
const Page = () => (
<ErrorBoundary fallback="error">
<Suspense fallback="loading...">
<UserInfo userId={userId} />
<PostList userId={userId} />
<PromotionList userId={userId} />
</Suspense>
</ErrorBoundary>
<ErrorBoundary fallback="error">
<Suspense fallback="loading...">
<UserInfo userId={userId} />
<PostList userId={userId} />
<PromotionList userId={userId} />
</Suspense>
</ErrorBoundary>
)

const UserInfo = ({ userId }) => {
const { data: user } = useSuspenseQuery(userQueryOptions())
return <UserProfile {...user} />
const { data: user } = useSuspenseQuery(userQueryOptions())
return <UserProfile {...user} />
}

const PostList = ({ userId }) => {
const { data: posts } = useSuspenseQuery({
...postsQueryOptions();
select: (posts) => posts.filter(({ isPublic }) => isPublic),
})
return posts.map((post) => <PostListItem key={post.id} {...post} />)
const { data: posts } = useSuspenseQuery({
...postsQueryOptions(),
select: (posts) => posts.filter(({ isPublic }) => isPublic),
})
return posts.map((post) => <PostListItem key={post.id} {...post} />)
}

const PromotionList = ({ userId }) => {
const { data: promotions } = useSuspenseQuery(promotionsQueryOptions())
return promotions.map((promotion) => (
<PromotionListItem key={promotion.id} {...promotion} />
))
const { data: promotions } = useSuspenseQuery(promotionsQueryOptions())
return promotions.map((promotion) => (
<PromotionListItem key={promotion.id} {...promotion} />
))
}
```

Expand Down

0 comments on commit e3eace0

Please sign in to comment.