dotvvm
dotvvm copied to clipboard
Somehow indicate that ViewModel property is not transfered to or from server on postback.
When property has private or no setter it is not transferred to server like if [Bind(Direction.ServerToClient)]
was applied. This is correct behavior and can be useful in many situations, but there are situation, where the missing setter is a mistake and it is pretty hard to find.
Today I was fixing "a mysterious problem":
Maybe we could add a one line to QuickInfo that would say the binding direction:
It would appear on any class that inherits
DotvvmViewModelBase
, uses Bind
atrribute, or the info is invoked from dothtml.
Another possibility is to show a little icon near the property identifier in dothtml markup
{value: Name} or {value:
Name} (these one are stolen from R#, we can have nicer ones)
Any other idea, anything to add? @martindybal @Mylan719
QuickInfo seems quite easy to implement, so we should do it first.
I cannot imagine how icons would look like in the DOTHTML markup, maybe we can try to make some mockup image to see how it can look like. I think that the arrows should be vertical - arrow down is used for downloading (which is basically server to client) and arrow up means uploading (which is client to server).
What I would like to see in the future is some diagnostics tooling - maybe a DotVVM Diagnostics tab in Visual Studio which would show all postbacks and viewmodels, with navigation to command method, viewmodel properties, diffing etc. But that's for a further discussion.
This brings me to idea that we should maybe employ concept of warnings tagged in different color. That would produce quickinfo content on its own. There are several cases that we discussed where warnings would be appropriate. We should tag an error only when exception would be trown in runtime.
@tomasherceg I made really professional and well looking MSPaint visualisation, but it should show the concept:
However I'm not sure if it's a good idea to introduce so much noise the in the code and I'm also not sure, how to implement this. But css editor has similar functionality for colors, so it should be feasible.
Diagnotic tab is for separate discussion and I'd make it as client-side script that would do that, not VS extension.
@Mylan719 We probabaly should underline errors in red and warnings in green, like other languages do. But the tagger is not 100% reliable and may have false positives (and quite a lot of them, when someone would use bit more advanced features) and even now, with the green color, I have seen devs complaining that it does not work although only tagger was wrong...
I think that the arrows can be smaller and less intense, and we need them only when the binding is not two-way.