Skip to content

UI hot reload #1

@PGimenez

Description

@PGimenez

One of the reasons why the page is not reloading when changing the UI code is that it is in an anonymous function. In this example, after editing the code in ui and uianon while the app is running, only the pages /page /file and /route are refreshed with the new content.

using GenieFramework
@genietools

@app begin
    @out var1 = 0
end

function ui()
    # StippleUI.layout(["aaa"])
    "<h1>test</h1>"
end

uianon = () -> "<h1>test</h1>"

@page("/page", ui)
@page("/file", "ui.jl")
route("/route") do
    model = @init
    page(model, ui) |> html
end
@page("/pageanon", uianon)
route("/routeanon") do
    model = @init
    page(model, uianon) |> html
end

However, changing the uidefinition in ui.jlto a standard function does not fix the reload issue. What does fix it is placing the entire uifunction inside app.jl, all in one file. Therefore, I guess the issue lies in how the code is imported via include.

Ideally we'd use @app("/", "ui.jl"), but we can't yet as there's an error related to q-layout(issue here). We'll look into it.

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