-
Notifications
You must be signed in to change notification settings - Fork 89
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
Update remoting to latest, docs for client #118
Conversation
Tested working combinations:
Testing thse combinations is very cumbersome and time-consuming: found a bug? then
Any effort to automate this would be highly appreciated |
@Zaid-Ajaj indeed, I had the same thoughts. I'm not sure how easy it would be to automate, but yes. Could you create an issue for it? |
@Zaid-Ajaj there are a few shortcuts around this, however. For example, you can install a template "over the top" of an existing folder, and it usually works fine. This removes the need to do the yarn download etc. etc. Also, did you test out giraffe? |
Yeah, sure
I will try it out
No, not yet, will do sometime today :) |
I've fixed that in latest - |
@Zaid-Ajaj see ad8bcbe - I've added a FAKE target to help with the test workflow. Also, I agree that testing the template is kinda cumbersome. |
@theimowski Thank you! I will test it out next time 😄 I have now tested giraffe with and without remoting and it seems to work (On My Machine™), I am working on windows 10 with dotnet 2.1.300 I came across another issue: I am noticing
only after I exit the process. This seems due to this block: let install = lazy DotNet.install DotNet.Versions.Release_2_1_300
let inline withWorkDir wd =
DotNet.Options.lift install.Value
>> DotNet.Options.withWorkingDirectory wd my workaround is to replace |
I'm considering removing the Relates to #79 |
This can be merged, if I missed something, just let know :) |
Actually there are 2 things (posted comments in code diff):
I'm fine with rest of changes |
That shouldn't be needed anymore when pulling lastest packages (also, I will try to publish one library with it's dependencies in one package)
In the context of this simple counter app, I agree with you. The reasoning behind this is for larger apps: usually a component doesn't ask for it's data when initialized at application startup, but when loaded or navigated to from other components where you will explicitly need to dispatch a message to initiate the request (hence the I can remove the message for now, but since we are on the subject, I was actually thinking of using a more representative app in the template like a to-do list instead of a counter: it showcases the used frameworks much better with a CRUD scenario while still being very simple to follow and understand What do you think? @isaacabraham @Krzysztof-Cieslak |
I'm happy to discuss the idea or more representative app, but let's make it a separate issue |
I'm definitely of the view that the template should be as simple as possible in terms of code. I really don't want to see it include CRUD stuff that is opinionated in any way or might not be applicable - we want the template to be useful for any SAFE app really. I'd say there's a good case to be made for creating such an example app to include in the SAFE github area like the bookstore etc |
I see, then we will keep it simple 😄 |
@@ -15,11 +15,9 @@ group Server | |||
//#if (!remoting && server != "suave") | |||
nuget Fable.JsonConverter | |||
//#elseif (remoting && server == "suave") | |||
nuget Fable.Remoting.Server ~> 3.6 | |||
nuget Fable.Remoting.Suave ~> 2.7 | |||
nuget Fable.Remoting.Suave |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we float pin to a major version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but it is not necessary afaik
Content/src/Client/Client.fs
Outdated
type Msg = | ||
| Increment | ||
| Decrement | ||
| Init of Result<Counter, exn> | ||
| LoadInitialCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this change, it's just additional step and IMO makes things more complex
// The update function computes the next state of the application based on the current state and the incoming events/messages | ||
// It can also run side-effects (encoded as commands) like calling the server via Http. | ||
// these commands in turn, can dispatch messages to which the update function will react. | ||
let update (msg : Msg) (currentModel : Model) : Model * Cmd<Msg> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer the shorter 6-line version
I'll merge it but revert this change afterrwards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it was just my personal preference to do it this way 👌
Also for future, please install https://editorconfig.org/ - we use it in SAFE template to handle white spaces in a consistent shape |
Good idea, that's why I always seemed to get the space diffs on my commits |
Unfortunately I had to revert this PR - sorry, should have tested it before merging. |
Hmm before the last change (removing the client msg) the template was working fine... |
It failed on:
|
I've rebased the commits now on new master, the changes are released in 0.26 - thanks again for contribution! |
This PR updates remoting to latest version and api, I also took the liberty and updated a couple of things along the way, PLEASE REVIEW (I haven't tested every possible combination):
Client
Added docs to model, msg, init and update
type Model = Counter option
becametype Model = { Counter: Counter option }
The messages now became:
where
LoadInitialCount
is a message the initiates the request andInitialCountLoaded
is the one that results from the (http) request, andinit()
becomes:Saturn
use_router
instead ofrouter
as per the depreciation messagedisable_diagnostics
doesn't seem necessary anymore with remoting enabled (probably because the routing with remoting doesn't rely on existing combinators any more)Suave
opening
Suave.Filters
andSuave.Successful
instead of fully qualifying them with theOK
andpath
web parts (it is common that they are fully qualified?)build.fsx
DotNet.Release_2_1_300
=>DotNet.Versions.Release_2_1_300
as per the depreciation messageRun
target isClean
-ed before running