Skip to content
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

Use ScrollableContainer's bottomReached event to load more #3781

Merged
merged 1 commit into from
May 21, 2024

Conversation

Caleb-T-Owens
Copy link
Contributor

Bit of a refactor over my async/await based gradual rendering.

It was still struggling if you had in the neigherbourhood of 9000 files, so this will only render as the user scrolls down.

There is still the issue of scrolling taking quite a long time, but it feels like the solution would need to be a floating commit button.

@Caleb-T-Owens
Copy link
Contributor Author

@mtsgrd I've taken a look round at what the different methods of sending messages to children are, and in this case I thought the exported functions looked best, but I'm curious to know if you're aware of a better svelt-ey mechanism that I could use in this case.

I did consider an BehaviourSubject in a context, but we've generally tried to keep RX.js internal to our services

Comment on lines 33 to 37
// Make sure we display when the file list is reset
$: {
chunkedFiles = chunk(sortLikeFileTree(files), 100);
displayedFiles = chunkedFiles[0] || [];
currentDisplayIndex = 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how you feel here, but I prefer making a function for these things (to make it evident what the change detection depends on).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes quite a bit of sense as a pattern 👍

@mtsgrd
Copy link
Contributor

mtsgrd commented May 20, 2024

A store could perhaps also work, but I like this solution, it feels like an appropriate and unsurprising way of doing it.

Bit of a refactor over my async/await based gradual rendering.

It was still struggling if you had in the neigherbourhood of 9000 files, so this will only render as the user scrolls down.

There is still the issue of scrolling taking quite a long time, but it feels like the solution would need to be a floating commit button.
@Caleb-T-Owens Caleb-T-Owens merged commit e2c88d8 into master May 21, 2024
15 checks passed
@Caleb-T-Owens Caleb-T-Owens deleted the improve-lazy-file-list branch May 21, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants