-
Notifications
You must be signed in to change notification settings - Fork 52
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
[Feature]: Support lazy load <InView />
#1071
Comments
const posts = useSuspenseQuery(postsQueryOptions(...))
return posts.map((post) => (
<Suspense intersection fallback={({ intersectionRef }) => <Skeleton ref={intersectionRef} />}>
<SuspenseQuery {postQueryOptions(post.id)}>
{(post) => <Post {...post} />}
</SuspenseQuery>
</Suspense>
)
) @gwansikk @kangju2000 @bigsaigon333 |
<Suspense/>
<Suspense/>
<Suspense/>
Oh, that's a great idea! It seems useful for gradually loading the necessary data for users through lazy loading |
How about this interface ? const posts = useSuspenseQuery(postsQueryOptions(...))
<Suspense when="intersectionObserve"></Suspense>
<Suspense when="render"></Suspense> // default
<Suspense triggerBy="intersectionObserve"></Suspense>
<Suspense triggerBy="render"></Suspense> // default I think the |
However, I think Intersection Observe should have more options. For example, I thought, "How do I set these options?" |
const posts = useSuspenseQuery({
...otherOptions,
observeRef: ref
})
return <div ref={ref} How about this approach: |
We should support react-native and web at once too! |
<InView>
{(trigger) => (
<div ref={trigger.ref}>
<Suspense enabled={trigger.isInView} fallback={<Spinner/>}>
<SuspensQuery />
</Suspense>
</div>
)}
</InView> |
<InView>
{(target) => (
<div ref={target.ref}>
<Suspense fallback={<Spinner/>}>
{target.isInView ? <SuspensQuery/> : <SuspenseAllTime/>}
</Suspense>
</div>
)}
</InView> |
related with #1093 #1109 #1072 #1071 # Overview <!-- A clear and concise description of what this pr is about. --> I want to support isomorphic `<InView/>`, `<FadeIn/>` for react-dom and react-native at once. This pull request is start for it - @suspenisve/react-native - @suspenisve/react-dom ![Jul-27-2024 05-05-21-min](https://github.com/user-attachments/assets/ce5bc8bd-9a96-42b3-b954-672dacbc0dec) ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests.
<Suspense/>
<InView />
related with #1093 #1109 #1072 #1071 # Overview <!-- A clear and concise description of what this pr is about. --> I want to support isomorphic `<InView/>`, `<FadeIn/>` for react-dom and react-native at once. This pull request is start for it - @suspenisve/react-native - @suspenisve/react-dom ![Jul-27-2024 05-05-21-min](https://github.com/user-attachments/assets/ce5bc8bd-9a96-42b3-b954-672dacbc0dec) ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests.
related with #1093 #1109 #1072 #1071 # Overview <!-- A clear and concise description of what this pr is about. --> I want to support isomorphic `<InView/>`, `<FadeIn/>` for react-dom and react-native at once. This pull request is start for it - @suspenisve/react-native - @suspenisve/react-dom ![Jul-27-2024 05-05-21-min](https://github.com/user-attachments/assets/ce5bc8bd-9a96-42b3-b954-672dacbc0dec) ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests.
related with #1093 #1109 #1072 #1071 # Overview <!-- A clear and concise description of what this pr is about. --> I want to support isomorphic `<InView/>`, `<FadeIn/>` for react-dom and react-native at once. This pull request is start for it - @suspenisve/react-native - @suspenisve/react-dom ![Jul-27-2024 05-05-21-min](https://github.com/user-attachments/assets/ce5bc8bd-9a96-42b3-b954-672dacbc0dec) ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests.
related with #1093 #1109 #1072 #1071 # Overview <!-- A clear and concise description of what this pr is about. --> I want to support isomorphic `<InView/>`, `<FadeIn/>` for react-dom and react-native at once. This pull request is start for it - @suspenisve/react-native - @suspenisve/react-dom ![Jul-27-2024 05-05-21-min](https://github.com/user-attachments/assets/ce5bc8bd-9a96-42b3-b954-672dacbc0dec) ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests.
related with #1071 # Overview <!-- A clear and concise description of what this pr is about. --> ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests. --------- Co-authored-by: Hyeonjae Lee <[email protected]> Co-authored-by: Jun <[email protected]> Co-authored-by: GwanSik Kim <[email protected]> Co-authored-by: 김동희 <[email protected]> Co-authored-by: Juhyeok Kang <[email protected]> Co-authored-by: 김석진(poki) <[email protected]>
related with #1071 # Overview <!-- A clear and concise description of what this pr is about. --> ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests. --------- Co-authored-by: Hyeonjae Lee <[email protected]> Co-authored-by: Jun <[email protected]> Co-authored-by: GwanSik Kim <[email protected]> Co-authored-by: 김동희 <[email protected]> Co-authored-by: Juhyeok Kang <[email protected]> Co-authored-by: 김석진(poki) <[email protected]>
Package Scope
etc
Description
@suspensive/intersection to trigger fetch on view inside of window
Possible Solution
etc.
No response
The text was updated successfully, but these errors were encountered: