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

[Masonry] Add virtualization support #28586

Closed
1 task done
Primajin opened this issue Sep 25, 2021 · 3 comments
Closed
1 task done

[Masonry] Add virtualization support #28586

Primajin opened this issue Sep 25, 2021 · 3 comments
Labels
component: masonry This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@Primajin
Copy link
Contributor

Primajin commented Sep 25, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

There are some technical limitations for having many items in Masonry (see #27934 (comment)) - if we virtualize the center part we only need to render X things and might be able to workaround the limitation.

Furthermore we could use this for an infinite scroll Masonry gallery

Examples 🌈

https://mui.com/components/image-list/#masonry-image-list

Motivation 🔦

See summary

@Primajin Primajin added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 25, 2021
@oliviertassinari oliviertassinari added the component: masonry This is the name of the generic UI component, not the React module! label Sep 25, 2021
@oliviertassinari oliviertassinari changed the title Add virtualization to Masonry [Masonry] Add virtualization support Sep 25, 2021
@hbjORbj
Copy link
Member

hbjORbj commented Sep 27, 2021

There are some technical limitations for having many items in Masonry (see #27934 (comment)) - if we virtualize the center part we only need to render X things and might be able to workaround the limitation.

@Primajin Thanks for creating this issue. The main obstacles to virtualization for the current implementation of masonry component are that (1) items are not aligned in a row, as they are in a normal grid, and that (2) each item spans a different number of rows. Hence, deciding "when" to hide or display items is tricky.

I thought of using an Intersection observer API on every MasonryItem and hide an item (AFAIK, the only way to do this is to set grid-row-end to span 0) when its bottom is out of view. However, we need a dummy item that has the same height of the hidden grid item so that items do not move around. I couldn't find a way to achieve this.

Do you have any ideas on this?

@hbjORbj hbjORbj added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 30, 2021
@o-alexandrov
Copy link
Contributor

@hbjORbj you might be interested in the ideas discussed in this thread:

@zhouzi
Copy link

zhouzi commented Feb 24, 2023

I see that this issue has been closed as completed but I can't find any documentation about it. What's mui's team's stance? Is it something that won't be implemented? Or perhaps there's a known working solution already?

cc @mbrookes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: masonry This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

6 participants