Skip to content

Elmish: view not refreshing when state changes #439

Answered by JaggerJo
doxxx asked this question in Q&A
Discussion options

You must be logged in to vote

Ahh, now I see what's going on.

You need to add this call to your elmish program. You are only allowed to do UI updates from the UI thread.

let runWithAvaloniaSyncDispatch (arg: 'arg) (program : Program<'arg, 'model, 'msg, #IView>) =

        Elmish.Program.mkProgram TestApp.init TestApp.update TestApp.view
        |> Program.withHost this
        |> runWithAvaloniaSyncDispatch // this line
        |> Program.withConsoleTrace
        |> Program.run

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@doxxx
Comment options

@JaggerJo
Comment options

@doxxx
Comment options

@JaggerJo
Comment options

Answer selected by doxxx
@doxxx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants