Skip to content

Upgrading to Fable.Lit 1.4.2 causes issues in Elmish types #72

@leolorenzoluis

Description

@leolorenzoluis

I am testing with the Fable.LitRouter and LitState but it requires 1.4.2, I get compilation error if I get 1.4.2 but if I downgrade to 1.4.1 then there's no error. This is just showing in Jetbrain's Rider. If I compile with npm run start then there's no error.

Looking at the commit history/release notes there shouldn't be anything that should affect this in 1.4.2.

Screen Shot 2022-09-27 at 5 53 32 PM

Screen Shot 2022-09-27 at 5 56 47 PM

Looking at the release notes there shouldn't be any impact on the Elmish/Lit libs.

For reference this is the sample code that I tried and updating new variables to make it minimal


let initialState1() =
    let monitorPageModel, monitorPageMsg = ListMonitorsPage.init()
    let welcomePageModel, welcomePageMsg = WelcomePage.init()
    
    let model = { CurrentPage = Anonymous AnonymousPage.Welcome; ServerMessage = []; MonitorModel =  monitorPageModel; WelcomePageModel = welcomePageModel }
    model, Cmd.none
    
let update1 msg model =
    model, Cmd.none

let view1 model dispatch =
    html $"""
    <div>Hello world</div>
    """


Program.mkProgram initialState update view
|> Program.withLit "my-app"
|> Program.withBridgeConfig (Bridge.endpoint socketEndpoint |> Bridge.withMapping ServerMsg)
|> Program.run

Screen Shot 2022-09-27 at 5 57 51 PM

Update:

Looks like something in these two packages are causing the compiler to get confused.

<PackageReference Include="Fable.LitRouter" Version="1.0.0-beta-005" />
<PackageReference Include="Fable.LitStore" Version="1.0.0-beta-001" />

If I remove that and just keep Lit to 1.4.2 it has no compile error

I've narrowed it down. It's the Fable.LitRouter that's causing an issue. Not sure where the source code for LitRouter is?

I extracted the library and I don't get any errors, so not sure why this is happening?

I removed the Fable.LitRouter and just created a separate fs file from https://nuget.info/packages/Fable.LitRouter/1.0.0-beta-005 Maybe @JordanMarr knows?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions