Skip to content

Commit

Permalink
Merge pull request #355 from TimLariviere/fix-liveupdate
Browse files Browse the repository at this point in the history
LiveUpdate - Fix types sent over network
  • Loading branch information
TimLariviere authored Mar 6, 2019
2 parents 6a4efaa + f99fe36 commit 08d4f77
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Fabulous.LiveUpdate/LiveUpdate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ type HttpServer(?port) =
if (path = "/update") then
let reader = new StreamReader (c.Request.InputStream, Encoding.UTF8)
let! requestText = reader.ReadToEndAsync () |> Async.AwaitTask
let req = Newtonsoft.Json.JsonConvert.DeserializeObject<DFile[]>(requestText)
let req = Newtonsoft.Json.JsonConvert.DeserializeObject<(string * DFile)[]>(requestText)
//let req = serializer.UnPickleOfString<DFile>(requestText)
let resp = switchD req
return Newtonsoft.Json.JsonConvert.SerializeObject resp
Expand Down Expand Up @@ -211,15 +211,15 @@ module Extensions =

let interp = EvalContext(System.Reflection.Assembly.Load)

let switchD (files: DFile[]) =
let switchD (files: (string * DFile)[]) =
lock interp (fun () ->
let res =
try
for file in files do
for (_, file) in files do
printfn "LiveUpdate: adding declarations...."
interp.AddDecls file.Code

for file in files do
for (_, file) in files do
printfn "LiveUpdate: evaluating decls in code package for side effects...."
interp.EvalDecls (envEmpty, file.Code)
Result.Ok ()
Expand All @@ -239,7 +239,7 @@ module Extensions =
| 0 -> { Quacked = "couldn't quack! Files were empty!" }
| _ ->
let result =
files |> Array.tryPick (fun file ->
files |> Array.tryPick (fun (_, file) ->

let programOptD =
match tryFindMemberByName "programLiveUpdate" file.Code with
Expand Down

0 comments on commit 08d4f77

Please sign in to comment.