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

do not prepend if already reloading #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kyrasteen
Copy link

Hello!

I really appreciate the work done for this component, so thank you!

I found a positioning issue with a particular use case I have. I am prepending items to the masonry layout while maintaining the position/index of some existing items. I am not using the 'stamp' option of masonry in order to still utilize the layout/positioning logic for the 'stuck' items.

Here is a simplified example of the issue:
https://codesandbox.io/s/m5888np119

If you click 'prepend' you will see the positioning issue. The turquoise item should be kept in place. I would like the end result for the example to look like this after prepending one item:
screen shot 2018-06-14 at 3 06 16 pm

If a child of the masonry layout has an image, I have seen the issue be resolved most of the time by the layout call in the images loaded callback, but not always.

Didn't see the need to prepend the new item(s) when items are already being reloaded before a layout call. Let me know what you think of the change. :)

@kyrasteen kyrasteen force-pushed the bugfix/prepend-reorder branch from 84ab162 to 72383bd Compare June 15, 2018 00:28
expect(secondElements[i].style.left).toEqual(secondPositions[i].left + 'px');
expect(secondElements[i].style.top).toEqual(secondPositions[i].top + 'px');
}
// done();
Copy link
Author

Choose a reason for hiding this comment

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

@eiriklv - I updated this test to account for masonry's default transitionDuration. I will look into it further, but there seems to be a timing issue when the done callback is utilized here (test fails).

@afram
Copy link
Collaborator

afram commented Jun 21, 2018

Thanks for the PR @kyrasteen :-)
Will look this weekend when I get moment if that's ok

@hutber
Copy link

hutber commented Jan 13, 2021

Possible the oldest approved PR I've seen in a very very long time :D @afram lol

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.

3 participants