feat: Implement Infinite Scroll on Historical Polls Page #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces the infinite scroll functionality to the historical polls page, enhancing user experience by dynamically loading more poll results as the user scrolls. This implementation includes optimizations for both mobile and desktop platforms, ensuring smooth and efficient data loading.
Changes Made
HistoricPoll.tsx
visiblePolls
,page
, andloadingMore
to manage poll visibility, pagination, and loading state.loadMorePolls
function to handle the logic for loading more polls with a delay.debounce
utility to handle scroll events efficiently and prevent excessive function calls.handleScroll
function to detect when the user has scrolled to the bottom and load additional polls.useEffect
hooks to initialize and update thevisiblePolls
state based on the current page and total polls available.methods.ts
debounce
utility function to limit the frequency of function execution, improving performance during scroll events.Screenshots
Testing Instructions
Additional Notes
By implementing these changes, the historical polls page will provide a more seamless and efficient user experience with infinite scrolling capabilities.