Skip to content

Conversation

@finnar-bin
Copy link
Contributor

Only perform the api call to fetch comment by resource item when the component is in view to prevent firing off multiple api requests once a content item is loaded
Resolves #3897

Screencast_20251119_115912.webm

@finnar-bin finnar-bin self-assigned this Nov 19, 2025
@finnar-bin finnar-bin added the bug Something isn't working label Nov 19, 2025
@shrunyan
Copy link
Contributor

I like the general idea. Would this be better implemented as a custom hook? this way we could apply the technique elsewhere?

@finnar-bin
Copy link
Contributor Author

@shrunyan yeah, that makes sense. I'll do just that.

@finnar-bin finnar-bin requested a review from agalin920 November 25, 2025 04:58
@finnar-bin
Copy link
Contributor Author

@shrunyan converted to a hook as suggested

@agalin920
Copy link
Contributor

@finnar-bin
Copy link
Contributor Author

finnar-bin commented Dec 10, 2025

@finnar-bin https://github.com/streamich/react-use/blob/master/src/useIntersection.ts

@agalin920 I've updated the code to make use of the already existing intersection hook from react-use. I tried making eratic and fast scrolls and wasn't able to see any major slow downs on the app despite the button being re-rendered everytime due to the intersection observer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

N+1 API Call

5 participants