Updating equation which defines when to fetch while scrolling #99
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.
Reason: Fetching is not working when the scrollbar has reached the end. I can't pinpoint the exact issue but this is caused by
window.pageYOffset
being little less than the actual length.Detailed explanation: I found the issue in "Archives" tab and was using Opera desktop browser when I found this issue. When I scrolled to the end of the document, the document isn't fetching more solutions which is supposed to be the intended behavior by the looks of
useInfiniteScroll
implementation. Even though the same issue isn't replicated in Chrome, this isn't browser issue as I found out "Solutions" tab also has the same issue in both browsers. Maybe the issue is related to device dimensions.Solution:
Math.ceil
fixes this issue at the cost of fetching solutions1px
earlier which shouldn't be an issue. Maybe there is a better way to fix this issue.Math.round
doesn't work for "Solutions" tab as thewindow.pageYOffset
value is less thanactual_length-0.5px
and this implementation rounds to a lower value.Sidenote: This is regarding repository. There are quite a few dependency conflicts while I was installing the dependencies. I tried with npm and yarn separately, both got few conflicts, so I don't think that is the issue. I have to make few changes to dependency versions and the actual code to make the webapp running. I am not pushing those changes here as they might not be the correct way to make this app running and might even break the app. Please let me know if I am doing something wrong or update app to the latest versions.