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

Memory: update="@form" causes DOM Leak #11702

Closed
melloware opened this issue Mar 30, 2024 · 2 comments · Fixed by #11708
Closed

Memory: update="@form" causes DOM Leak #11702

melloware opened this issue Mar 30, 2024 · 2 comments · Fixed by #11708
Assignees
Labels
⚡ performance Performance related issue or enhancement
Milestone

Comments

@melloware
Copy link
Member

This was actually been around since 2013 I found this forum post: https://forum.primefaces.org/viewtopic.php?p=112616&sid=bc050d696d9491eda81c886c272f705b#p112616

Simple example:

    <h:form id="frmSimple">
        <p:selectBooleanCheckbox value="#{simpleView.rendered}" itemLabel="Show/Hide">
            <p:ajax update="@form" />
        </p:selectBooleanCheckbox>
        <p></p>
        <div jsf:id="inputs">
            <p:inputText id="input" widgetVar="wgtInput" value="#{simpleView.text}" rendered="#{simpleView.rendered}">
                <p:ajax event="keyup" update="display2" process="@this" />
            </p:inputText>
            <p></p>
            <h:outputText id="display2" value="#{simpleView.text}" rendered="#{simpleView.rendered}" />
        </div>
    </h:form>

Every time you AJAX update @form or :formSimple or any variation you will see leaked DOM elements because the old form has jQuery handlers on it.

image

@melloware melloware self-assigned this Mar 30, 2024
@melloware melloware added the ⚡ performance Performance related issue or enhancement label Mar 30, 2024
@melloware melloware added this to the 13.0.8 milestone Apr 1, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 1, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 1, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 1, 2024
@tandraschko
Copy link
Member

Can you explain a bit more what exactly leaks here and why?

Same like the Ajax Case
Widget gets destroyed, the Widget and jquery vars are unused, why cant it be garbage collected?

melloware added a commit to melloware/primefaces that referenced this issue Apr 1, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 1, 2024
@melloware
Copy link
Member Author

i will put together a small test case for you.

melloware added a commit to melloware/primefaces that referenced this issue Apr 3, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 3, 2024
melloware added a commit to melloware/primefaces that referenced this issue Apr 3, 2024
tandraschko pushed a commit that referenced this issue Apr 4, 2024
* Fix #11702: DOM leaks on AJAX update

* Fix #11702: DOM leaks on AJAX update
melloware added a commit to melloware/primefaces that referenced this issue Apr 5, 2024
melloware added a commit that referenced this issue Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ performance Performance related issue or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants