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
Subproperties in template models do not get updated on the server #3117
Comments
Could you re-test or give a more complete example. |
I updated to latest flow/vaadin and i still seem to have the same issue. The project is our tshirt demo that we use at conferences: https://github.com/vaadin/tshirt-shop-flow |
I can't see that repository. I only see -vaadin and -polymer |
Try now. |
Now I see it. |
This took me way too long to figure out. The problem is that the
|
We should probably at least highlight his use case as an example in the tutorial. It is a gotcha that can cause lots of frustration and lost time for users. |
From the template-model-bean tutorial:
|
Thanks, that explains it. I read those sentences a few times while trying to figure this out, but I understood it that I just won't get the same instance of the bean back. It was unexpected that I got an object that looks like the one I want, but doesn't contain the data I updated. I think that this will be something many will run into, so let's see if we can either have it somehow return a populated object, or at least document it more clearly. |
The reason for not returning the original object is to be able to know that the developer has been running setters on the instance so that Flow can send those updated values to the client. This is an alternative solution to the problem that Polymer has "solved" by forcing you to do Each approach requires the developer to be aware of the situation. I'm not aware of any good way of getting rid of both of the drawbacks at once (the bad way that I'm aware of is the FW7 way of keeping a separate copy of the data and scheduling a dirty check any time you've done |
Sure. I think that's fine as long as we make it clear to the developer. Perhaps I read the docs too quickly, but I still did wrong even after reading them. Would be good if we could try to make it even more apparent for developers to avoid frustration down the line. |
Yes. The documentation should probably be changed somehow, so if you have an idea how it should be reworded or a sample to highlight this, it would be welcome. |
Flow version: 1.0.0.alpha11
When using an object in a TemplateModel and binding to sub properties in the template, I expect to be able to access the updated values in an eventhandler method.
Relevant parts of the code:
Java:
Template:
I can verify that the
submit
method does get called and that theorder
property in the Polymer component has been updated correctly.The text was updated successfully, but these errors were encountered: