These are chat archives for jdubray/sam

26th
Jan 2018
Michael Terry
@formido
Jan 26 2018 00:26
The top comment here may appeal to some of us
Jean-Jacques Dubray
@jdubray
Jan 26 2018 03:20
@formido I am speechless...
@ashalkhakov yes, if I understand your code correctly you made "functional XAML" work.

The idea of adjusting the form based on model data in a linear fashion is great!

that's music to my ears!

Scott Conklin
@srconklin
Jan 26 2018 16:56
I know this has been discussed before but I can't seem to find it when I search history... I am looking for the best practice on how to handle ajax requests to retrieve data from the server side (php/DB) in SAM... I think I recall that actions is where that should be handled but also remember someone saying it could be done in NAP...?
for example: an autocomplete textbox that queries addresses while typing OR onSelect of an address from that list where a request to the server to retrieve details about the property.... etc.
Is there an example for something like this in the Code Samples?
Jean-Jacques Dubray
@jdubray
Jan 26 2018 17:19
@srconklin yes, correct, an action can make an API call and present the results to the model. IMHO, that's the best way to do. I tried NAP on a project and it was a disaster because you need manage ancillary state machines like "fetching".
Scott Conklin
@srconklin
Jan 26 2018 17:19
@jdubray thanks.
Jean-Jacques Dubray
@jdubray
Jan 26 2018 17:19
Yes, I have implemented several autocomplete fields using that technique.
The only thing tricky with autocomplete is the focus on the input field.
Scott Conklin
@srconklin
Jan 26 2018 17:22
@jdubray regarding the autocomplete focus being tricky... You mean when the view is constantly being updated while the results are changing?
Jean-Jacques Dubray
@jdubray
Jan 26 2018 17:22
yes
you need to return the focus, I do that with NAP though that action is not updating the model.
Scott Conklin
@srconklin
Jan 26 2018 17:23
ok thanks
Jean-Jacques Dubray
@jdubray
Jan 26 2018 17:24
It's not that hard, just annoying. This should be out of the box in HTML.
Scott Conklin
@srconklin
Jan 26 2018 17:25
well, isn't the model involved somewhat... eg: model.AutocCompleteInProgess ? so that it is not fired on every NAP call... from actions that having nothing to do with the autocomplete?
Jean-Jacques Dubray
@jdubray
Jan 26 2018 17:25
I could not find how to do it in Angular2 without coding it myself, not sure if React/Vue/Angular offer out-of-the-box capabilities.
yes, absolutely, but there is no update/proposal to the model in that particular action, just returning focus to the field.
Scott Conklin
@srconklin
Jan 26 2018 17:27
ah yes... of course
Jean-Jacques Dubray
@jdubray
Jan 26 2018 17:28
You are using SAM?
Scott Conklin
@srconklin
Jan 26 2018 17:31
yes well I am gonig to for a new project that I just got
I have used in the past for another smaller project but have never made ajax calls to retrieve data on the server side
Jean-Jacques Dubray
@jdubray
Jan 26 2018 18:15
that's great to hear!
Jean-Jacques Dubray
@jdubray
Jan 26 2018 19:42
Somewhat interesting article on Monads from a time dependency's perspective. I think I officially have the positions that FP is a very bad idea.
You simply cannot write your code from the perspective of assembling actions. Makes no sense to me, in general. That's kind of what I thought I understood from our previous discussion. Yes, that's a form of temporal logic, but a highly inflexible one.
The questions from Patrik Iselind at the bottom of the article are particularly insightful (and the answers as well).
Jean-Jacques Dubray
@jdubray
Jan 26 2018 20:08
JS-In-CSS style sheets (JIC) with template literals
The flexibility of JS-in-CSS lets you express yourself in a natural way, and allows you to easily create the abstractions and interfaces you want to work with when you're approaching design. Most importantly, JIS stylesheets let you harness and benefit from all of the CSS and JavaScript knowledge you already have, and lets you put them to work for styling.