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

new InfiniteViewer will empty the iframe #52

Open
zlyyyy opened this issue Jun 16, 2023 · 7 comments
Open

new InfiniteViewer will empty the iframe #52

zlyyyy opened this issue Jun 16, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@zlyyyy
Copy link

zlyyyy commented Jun 16, 2023

There is an iframe in the viewport, and the content of the iframe will be cleared after the new InfiniteViewer

@zlyyyy
Copy link
Author

zlyyyy commented Jun 16, 2023

@zlyyyy
Copy link
Author

zlyyyy commented Jun 16, 2023

image
emty dom

@zlyyyy
Copy link
Author

zlyyyy commented Jun 16, 2023

@daybrush
Trying to downgrade the version can't solve it, it seems to be a persistent problem

@zlyyyy
Copy link
Author

zlyyyy commented Jun 16, 2023

image
It is normal to write before iframe write, and init will reproduce after write

@zlyyyy
Copy link
Author

zlyyyy commented Jun 16, 2023

After looking at the source code, these two lines of code lead to

        if (!wrapperElement) {
            wrapperElement = doc.createElement("div");
            wrapperElement.insertBefore(this._viewportElement, null);
            containerElement.insertBefore(wrapperElement, null);
        }
<iframe> may be lost when moving it to another parent element using insertBefore. This is due to browser behavior when re-rendering an <iframe>

At present, I skipped here and solved it by manually specifying wrapperElement

const infiniteViewer = new InfiniteViewer(view, viewport, {
        wrapperElement: wrapper
}

@daybrush daybrush added the bug Something isn't working label Jun 17, 2023
@daybrush
Copy link
Owner

@zlyyyy

If there is an iframe inside the viewport, refresh may occur during the process of appendChild and insertBefore.
As in your comment, it's probably best to set the wrapperElement as an ad-hoc.

The framework also creates a wrapper and sets it through props.

@zlyyyy
Copy link
Author

zlyyyy commented Jun 19, 2023

@daybrush Yes, I temporarily solved it by setting wrapperElement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants