Feature #4898
closedBug with making changes to widgets in WWidget::render() during learned slot event
0%
Description
When any changes made in WWidget::render() for a stateless slot, no changes are actually outputted to the browser. For example when a WMenu item is triggered() and render() updates a widget, nothing is changed in the browser.
I've uploaded a test file.
Files
Updated by Koen Deforche almost 10 years ago
- Tracker changed from Bug to Feature
- Status changed from New to Feedback
Hey,
Indeed a stateless slot is limited to only the same 'effect' which can then be pre-learned. In your case, you cannot simply reimplement propagateSetVisible() as the effect of this function will be prelearned. The WMenuItem::triggered() signal however is safe to react to.
I do agree there is something lacking, namely the ability to indicate to Wt that a certain function will violate a stateless slot learning contract, which would then let Wt drop this client-side optimization, something like WWebWidget::isNotStateless() which simply invalidates the use of this function inside a stateless slot.
Regards,
koen
Updated by Saif Rehman almost 10 years ago
By "simply invalidates the use of this function inside a stateless slot" do you mean that updates will not be discarded in the case of such functions? I guess that would be a useful feature.
Could you suggest me an alternative. One alternative that I have in mind is to use a JSignal and track the changes with JavaScript, however, I was hoping to use a server side method
Btw I forgot that propagateSetVisible() is my own implementation so I've attached a diff file, its just a copy of propagateSetEnabled(). If you feel like Wt could use this function then feel free to apply it :)
Updated by Saif Rehman almost 10 years ago
- File commit-67d3e2e.diff commit-67d3e2e.diff added
Updated by Koen Deforche almost 10 years ago
- Status changed from Feedback to InProgress
- Assignee set to Roel Standaert
- Target version set to 3.3.6
Ah, I didn't realize and confused propagateSetVisible() with propagateSetEnabled(). I think it might make sense in conjunction with the new feature to invalidate stateless slot learning.
Updated by Koen Deforche almost 10 years ago
- Status changed from InProgress to Implemented @Emweb
A new function WObject::isNotStateless() was added for this.
Updated by Saif Rehman almost 10 years ago
Hey Koen, thanks for the fix. When will you push changes to GitHub?
Updated by Koen Deforche almost 10 years ago
- Status changed from Implemented @Emweb to Resolved
Updated by Saif Rehman over 9 years ago
Hey Koen and Roel, I tried using the isNotStateless() method and it still doesn't update. Please take a look. I've attached the updated test file.
Updated by Saif Rehman over 9 years ago
Ok I get it, I should call isNotStateless() without any condition.
Updated by Koen Deforche over 9 years ago
- Status changed from Resolved to Closed