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
View not destroyed when closing browser tab on page backed by omnifaces @ViewScoped #208
Comments
Unfortunately neither Mojarra nor MyFaces would clean up server side view state on this, but this is at least a start.
Reproduced. Nice find. Unfortunately, neither Mojarra nor MyFaces keeps server side view state "in sync" with PreDestroyViewMapEvent, so those server side view states still stick around. Your best bet is using client side state saving instead. Theoretically, we could solve this by providing our own server side state manager, but this is not a trivial task. I'd rather first look how the JSF API itself can be improved with regard to this. |
For now, I added a hack to explicitly remove Mojarra's server side view state. Your use case now works fine for me. It's available in today's 2.3 snapshot. Will look at MyFaces later. |
Thank you, @BalusC I assume no release date for 2.3 as it will be released "when its good and ready" ! |
When I'm 100% satisfied with o:socket. It's getting close :) |
MyFaces way of keeping track of views is kind of convoluted (see last commit), but your use case now also works fine for me in MyFaces. |
It's available in today's 2.3 snapshot. |
JSF own view scoped beans (javax.faces.bean/view.ViewScoped) associated with the view (only if the view has an OmniFaces CDI view scoped of course). Also, any component event listeners on UIViewRoot will be restored and those listening on PreDestroyViewMapEvent will be invoked.
(MyFaces autogenerated an ID which wasn't re-generated in postback, causing corrupted view state during unload)
(though using @ViewScoped beans in stateless JSF doesn't make sense)
I set the view/logical view limits to 3 and deployed a simple JSF page with omnifaces ViewScoped backing bean. Closing tabs does not appear to do anything. I would have expected the secondary beans to have been destroyed so that the first bean is never automatically expired.
I'm using GF 4.1, JSF 2.2, Omnifaces 2.2
Steps to reproduce:
javax.faces.application.ViewExpiredException: viewId:/viewBean.jsf - View /viewBean.jsf could not be restored.
web.xml:
ViewBean.java:
viewBean.xhtml:
The text was updated successfully, but these errors were encountered: