dotvvm icon indicating copy to clipboard operation
dotvvm copied to clipboard

Somehow indicate that ViewModel property is not transfered to or from server on postback.

Open exyi opened this issue 7 years ago • 4 comments

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": i166 pimgpsh_thumbnail_win_distr

Maybe we could add a one line to QuickInfo that would say the binding direction: i167 pimgpsh_thumbnail_win_distr 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: 0a3e76ae1e230ba840f74b630926ae8777ef675e1b619d7ca7 pimgpsh_thumbnail_win_distrName} or {value: a8d9275441f8d02c31c83ef70647cfee81a1a36c9d12e76b60 pimgpsh_thumbnail_win_distr Name} (these one are stolen from R#, we can have nicer ones)

Any other idea, anything to add? @martindybal @Mylan719

exyi avatar Mar 18 '17 18:03 exyi

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.

tomasherceg avatar Mar 19 '17 21:03 tomasherceg

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.

Mylan719 avatar Mar 20 '17 11:03 Mylan719

@tomasherceg I made really professional and well looking MSPaint visualisation, but it should show the concept: untitled

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...

exyi avatar Mar 20 '17 15:03 exyi

I think that the arrows can be smaller and less intense, and we need them only when the binding is not two-way. binding

tomasherceg avatar Mar 21 '17 08:03 tomasherceg