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

Async data loading not supported ? #78

Closed
mmazloum opened this issue Apr 19, 2021 · 5 comments
Closed

Async data loading not supported ? #78

mmazloum opened this issue Apr 19, 2021 · 5 comments

Comments

@mmazloum
Copy link

I have a kind of portfolio page with async filters to display an artist portfolio. If I click on a tag, I call my server to fetch async data. The data arrive on my dom but masonry doesn't display them and their images properly.

If I fetch all my data before and just use filters without doing server side opérations, I find myself just like in the code provided in the masonry demo and everything works fine but it's a bit messy.

Any idea ?

@wynfred
Copy link
Owner

wynfred commented May 7, 2021

I'm not sure how you implemented it so it's difficult for me to guess what the issue is. But since you're clicking a tag and update the data, maybe you don't need to use the async pipe? If you can add an online repo that would be helpful.

@mmazloum
Copy link
Author

@wynfred found a work arround not using async pipe, fetching all the data before activating my items (not best solution but enough for my project).

However thanks for your work this ngx-masonry is usefull ;-)

If I have time i'll get back to you with a fix.

@zeroregard
Copy link

zeroregard commented May 11, 2021

Seconding this, you can test this with something like:

<ngx-masonry>
    <div ngxMasonryItem style="width:33%">
        static content
    </div>
     <div ngxMasonryItem style="width:33%">
        static content
    </div>
     <div ngxMasonryItem *ngIf="requestToApi$ | async as response" style="width:33%">
        {{ response }}
    </div>
</ngx-masonry>

The two first divs get a correct left css attribute while the async div gets: right: -150vw;


I'm reproducing this in a private corporate repository, but if I have time I'll see if I can make an open source reproduction repo. For now I'll have to make do as well with flexbox, but I would like to use this project in the future as it seems to be the only ivy-compatible masonry project that almost works for my work repository :D

@wynfred
Copy link
Owner

wynfred commented May 12, 2021

I didn't find the issue with async pipe but I did fix another bug that may cause similar behavior. Try the latest release and let me know if it works. Thanks!

@mmazloum
Copy link
Author

mmazloum commented May 12, 2021 via email

@wynfred wynfred closed this as completed Jun 7, 2021
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