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

Nesting v-masonry-tile in v-masonry causing slowdown #52

Open
tb-b opened this issue Feb 22, 2018 · 3 comments
Open

Nesting v-masonry-tile in v-masonry causing slowdown #52

tb-b opened this issue Feb 22, 2018 · 3 comments

Comments

@tb-b
Copy link

tb-b commented Feb 22, 2018

This is causing a significant slow down after several redraws (via router link for example). The issue seems to be in nesting v-masonry-tile inside of v-masonry like in docs:

<div v-masonry transition-duration="0.3s" item-selector=".item">
    <div v-masonry-tile class="item" v-for="(item, index) in blocks">
       <!-- block item markup -->
    </div>
</div>

Test scenario:

Array of 6 objects, setup as above

First run:

masonry.plugin.js outputs 6 elements (correctly)

Second run (redraw via router-link):

masonry.plugin.js outputs 18 elements (2 * 6 + 6)

Third run (redraw via router-link):

masonry.plugin.js outputs 42 elements (2 * 18 + 6)


As you can imagine this will clog your throughput pretty quickly, especially since every call is waits for imagesloaded.js to finish.

The easiest solution is to remove v-masonry-tile declaration from your HTML element, like this:

<div v-masonry transition-duration="0.3s" item-selector=".item">
    <div class="item" v-for="(item, index) in blocks">
       <!-- block item markup -->
    </div>
</div>
@shershen08
Copy link
Owner

shershen08 commented Feb 22, 2018

that looks like a major issue!
thanks for bringing it in @tombalev
do you maybe have a simplified repo/app that one could clone to reproduce this issue ?

@tb-b
Copy link
Author

tb-b commented Feb 22, 2018

not at the moment, but you can do something simple like vue-cli with vue-router, place vue-masonry grid on one page and then put console.log to vue-masonry masonry.plugin.js functions. This will get triggered on every router change X times.

Is there any significant use for that v-masonry-tile anyway? Seems to be working alright without it.

@Hadrien-DELAITRE
Copy link
Contributor

Maybe related to #57

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

No branches or pull requests

3 participants