Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Problem with state saving of dynamic components with/or without stateless view #4438

Open
przemcio opened this issue Jan 7, 2021 · 0 comments

Comments

@przemcio
Copy link

przemcio commented Jan 7, 2021

I have a problem with state saving of dynamic components. To get them working you need to do some equilibristic things and still some cases doesn't work. The behavior of the components is not consist when we take into account transient states. The incorrect behavior is reproducible on 2.2.20 (see attached application)

According to some test examples from mojarra source code. You can modify sub tree of component after PostAddToViewEvent sent from UIViewRoot. So you can registers on PostAddToViewEvent (source UIViewRoot) or PreRenderEvent and do some changes in sub-tree of the given component.

It worked without any problem with ancient 2.0.x But after some updated in 2.1 related to PSS it stopped to work "correctly". In some cases a part of components disappear from the screen or change an order.

I have prepared a test case matrix.
We have two components transient and the second one not transient. The components have some children defined in xhtml and they also add some new dynamic childs (which can do some actions).

Here are test cases checked:

---- The view is not transient ----

Dynamic component is not transient and change of sub-tree is done when:

-AddToViewEvent (allways)-> There is a change of order of the children (those from xhtml goes to the end.)

Seems bug related to indexing. In Post back components are not marked with dynamic_component ...

-PreRenderViewEvent & NotPostback -> On first sight the it work well but there is a case where the not transient component is in transient and this is not working.

In logs WARNING: Unable to save dynamic action with clientId.

Is there any way to get this thing to get work at all ?

-AddToViewEvent & NotPostback -> dynamically added component are not rendered after PostBack

-PreRenderViewEvent & NotPostback + AddToViewEvent & PostBack -> dynamic element are added twice

Transient component component change on
-PreRenderEvent & NotPostback + AddToViewEvent & Postback -> WORKS FINE in all cases.

---- The view is transient ----

Not transient component sub tree change on:

-PreRenderEvent & NotPostback -> Render only on first get then nothing works.

-AddToViewEvent & NotPostback -> Render only on first get then nothing works.

-AddToViewEvent (allways)-> Change of order of children (those from xhtml goes to the end.)

-PreRenderViewEvent & NotPostback + AddToViewEvent & PostBack -> Change of order of children (those from xhtml goes to the end.)

Transient component component change on
-PreRenderEvent & NotPostback + AddToViewEvent & Postback -> Change of order of children (those from xhtml goes to the end.)

-AddToViewEvent (allways)-> Change of order of children (those from xhtml goes to the end.)

There is a bonus case
if we have component in faces of and we would like to move it to somewhere else we need to do it PreRenderEvent if we do it PostAddToView the PSS will not record this correctly and before render when a tree is once again recreated moved component is removed from new palace.

Questions
Did I something wrong in a way how the dynamic components are modified?

Is there one approach which will work with transient and not transient views?

testcase_app_components.zip

Similar issues
eclipse-ee4j/mojarra#3506
eclipse-ee4j/mojarra#1558

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

No branches or pull requests

1 participant