Nhowka / Elmish.Bridge

Create client-server Fable-Elmish apps keeping a single mindset
MIT License
139 stars 17 forks source link

Elmish.Bridge.Client 3.1.1 not compatible with Fable.SimpleJson 3.6.0+? #21

Closed aornota closed 4 years ago

aornota commented 4 years ago

Using fable-compiler 3.4.10, all's fine with Fable.SimpleJson 3.5.0 - but with 3.6.0 or 3.7.0, I get a couple of build errors:

(Not a major problem: I can just stick with Fable.SimpleJson 3.5.0 for now. But thought it might be worth mentioning...)

Nhowka commented 4 years ago

Thanks for the report! Version 3.2.0 should be compatible.

aornota commented 4 years ago

That was quick ;) ... Many thanks; works with Fable.SimpleJson 3.7.0 for me.

fc1943s commented 4 years ago

Damn!! what a blessing to wake up and see the fix for something I was trying to go through and still had no idea it was Fable.SimpleJson!! thanks guys

But even after updating, im getting this error:

ERROR in ./Client.fs
Module Error (from ./node_modules/fable-loader/index.js):
D:/Client.fs(197,27): (197,33) error FABLE: Cannot get type info of generic parameter a$, please inline or inject a type resolver
 @ ./JobApi.fsproj 1:0-28 1:0-28
 @ multi ./JobApi.fsproj

I was trying to make it work with generics, but even after removing all of them, fable is still bitching about types (everything already inline). I will keep fiddling and if i have some additional info I might open a new issue or comment here. thanks again.

edit: this is the call where it breaks: |> Bridge.withMapping RemoteClientMessage

Nhowka commented 4 years ago

I'll probably need to inline all things... Probably it will be harmless except by the bundle size, but not sure if I can do anything different. Thanks for reporting!

Nhowka commented 4 years ago

Version 3.2.1 should be indexed soon. Let me know it if fixes the new problems!

fc1943s commented 4 years ago

Thanks! Still not working, its pretty weird. I will put more time to figure out how to report better whats going on. Will try to mess with the dependencies or even recreate the project. I already removed all generics from my types. At least it is not the "Msg" generic error anymore haha

When i have this, everything works fine.

    Program.mkProgram init update _view
    #if DEBUG
    |> Program.withConsoleTrace
    #endif
    |> Program.withReactSynchronous "elmish-app"
    |> Program.run

But with this, there is the error:

    Program.mkProgram init update _view
    |> Program.withBridgeConfig (Bridge.endpoint "/socket")
    #if DEBUG
    |> Program.withConsoleTrace
    #endif
    |> Program.withReactSynchronous "elmish-app"
    |> Program.run
ERROR in ./Client.fs
Module Error (from ./node_modules/fable-loader/index.js):
D:/Client.fs(197,27): (197,33) error FABLE: Cannot get type info of generic parameter a$, please inline or inject a type resolver
 @ ./JobApi.fsproj 1:0-28 1:0-28
 @ multi ./JobApi.fsproj
fc1943s commented 4 years ago

100% working now! I might have messed something up while removing the generics when trying to fix the "Msg" error earlier. Only your fix was enough. And I can keep my original code with generics \o/ Thanks guys

Nhowka commented 4 years ago

Glad to be helpful! I didn't finish unpacking after moving, so I'm not entirely updated about everything happening but please don't be shy if any update breaks the library again.