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

Issue when using more than one InfiniteGrid per page #491

Open
astralmedia opened this issue Jun 14, 2022 · 9 comments
Open

Issue when using more than one InfiniteGrid per page #491

astralmedia opened this issue Jun 14, 2022 · 9 comments
Labels

Comments

@astralmedia
Copy link

Description

Currently if I have more than one infinitegrid component in my DOM the 2nd one starts to glitch out a bit. It shows double the items, with the first set disappearing and reappearing as I scroll up and down.

Is there something I am missing from the docs that enables multiple of them to live side by side?

Steps to check or reproduce

@daybrush daybrush added the bug label Jun 15, 2022
@daybrush
Copy link
Member

daybrush commented Jun 15, 2022

@astralmedia

Could you provide a demo link or a gif?

I think it's probably something to do with the container option. Are you using window scrolling? Or are you using element scroll?

@astralmedia
Copy link
Author

not sure, how can I tell? I basically have this

@astralmedia
Copy link
Author

Also is there any way to disable to auto scrolling when content loads?

@daybrush
Copy link
Member

  1. Let me know if you used the container option. Or maybe it's the use of a duplicate key. It would be nice to have a demo/screenshot.

  2. disable scrollRestoration https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration

@astralmedia
Copy link
Author

Can't seem to figure out how to disable scrollRestoration in react...any chance you know a path?

Also, not sure what the container option is?

Thanks for your help, sorry, I manage a whole platform of codebases so my head is all over the place right now.

@astralmedia
Copy link
Author

Is there a way to stop the groups from disappearing as u scroll? Currently I am finding my content disappearing before its off screen.

@astralmedia
Copy link
Author

astralmedia commented Jul 25, 2022

fyi this is what im working with

<MasonryInfiniteGrid
        column={columnCount}
        gap={5}
        ref={gridRef}
        onRequestAppend={getNextRequest}
        useResizeObserver={true}
    >
        {items && _.get(items, "length", 0) > 0 && items.map((item, index) => {
            if(index+1 <= _.get(props, "limit", 9999)){
                const listTemplate = getTemplate(item, index)
                return listTemplate
            }
            
        })}
    </MasonryInfiniteGrid>

@daybrush
Copy link
Member

@astralmedia

Perhaps the distance between the container and the body is wrong.

First call the renderItems({ useResize: true }) method or

try setting the option to useRecycle: false

or Update react-infinitegrid version

@astralmedia
Copy link
Author

hrmm, didnt want to respond till i experimented a bit with this...but unfortunately trying all different combinations of the things you suggested I cannot get the auto scrolling on load to go away...I am starting to think its not the scroll restoration potentially as it happens on the first load of a completely new session in private mode. You would know better than me with an understanding of the inner workings.

I have "@egjs/react-infinitegrid": "^4.6.0", currently...it seems like the latest.

Thanks for trying to help me figure this out. Sorry to take so much back and forth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants