Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple app modules no longer works #698

Open
MariusDrulea opened this issue Jan 7, 2024 · 6 comments
Open

Multiple app modules no longer works #698

MariusDrulea opened this issue Jan 7, 2024 · 6 comments
Assignees

Comments

@MariusDrulea
Copy link

The example provided here does not seem to work after the most recent updates of genie, genieframework. Tested on an Ubuntu machine with Julia 1.10 and also Julia 1.9.4.
https://learn.genieframework.com/docs/guides/adding-reactive-pages#multiple-app-modules

The code compiles, but the web page does not display anything.

@MariusDrulea
Copy link
Author

MariusDrulea commented Jan 7, 2024

It works if I downgrade to:
Julia 1.9.4
(GeniePlay) pkg> status
[c43c736e] Genie v5.21.2 https://github.com/GenieFramework/Genie.jl.git#v5.21.2
[a59fdf5c] GenieFramework v1.26.4 https://github.com/GenieFramework/GenieFramework.jl.git#v1.26.4

It does not work if I:
Julia 1.10
(GeniePlay) pkg> st
[c43c736e] Genie v5.21.2 https://github.com/GenieFramework/Genie.jl.git#v5.21.2
[a59fdf5c] GenieFramework v1.26.4 https://github.com/GenieFramework/GenieFramework.jl.git#v1.26.4

So it's not just Julia 1.10, also the most recent versions of GenieFramework and Genie are causing this in Julia 1.9.4.

@MariusDrulea
Copy link
Author

Btw, the usage of Index and Form can be simplified like below, just use Index.ui instead of Main.App.Index.ui.

module App
  using GenieFramework
  @genietools

  include("Index.jl")
  include("Form.jl")


  @page("/", Index.ui, model=Index)
  @page("/form", Form.ui, model=Form)
end

@PGimenez PGimenez assigned PGimenez and unassigned essenciary Jan 8, 2024
@PGimenez
Copy link
Member

PGimenez commented Jan 8, 2024

@essenciary @hhaensel looks like the browser cannot subscribe to the channel
Screenshot 2024-01-08 at 10 27 34

I downgraded Genie to 5.21.2 as suggested by @MariusDrulea and it works on Julia 1.9.3. This is the code I'm testing with

module App

using GenieFramework
@genietools

module Index
using GenieFramework

@app begin
    @out name = "John"
end

function ui()
    h1("Welcome {{name}}!")
end

end

module Form
using GenieFramework
using Statistics

@app begin
    @in N = 0
    @out m = 0.0
    @onchange N begin
        @show N
        m = mean(rand(N))
    end
end

function ui()
    cell([
          textfield("How many numbers?", :N)
          p("The average of {{N}} random numbers is {{m}}")
         ])
end

end

using .Index
using .Form

@page("/", Main.App.Index.ui, model= Main.App.Index)
@page("/form", Main.App.Form.ui, model= Main.App.Form)

end

@essenciary
Copy link
Member

@MariusDrulea @PGimenez thanks, I'll allocate some time to debug it.

@essenciary
Copy link
Member

@MariusDrulea @PGimenez this is fixed in Stipple 0.27.30 but will require an extra configuration Stipple.ALWAYS_REGISTER_CHANNELS[] = true

Previous example adapted:

module App

using GenieFramework
@genietools

module Index
using GenieFramework
Stipple.ALWAYS_REGISTER_CHANNELS[] = true

@app begin
    @out name = "John"
end

function ui()
    h1("Welcome {{name}}!")
end

end

module Form
using GenieFramework
using Statistics
Stipple.ALWAYS_REGISTER_CHANNELS[] = true

@app begin
    @in N = 0
    @out m = 0.0
    @onchange N begin
        @show N
        m = mean(rand(N))
    end
end

function ui()
    cell([
          textfield("How many numbers?", :N)
          p("The average of {{N}} random numbers is {{m}}")
         ])
end

end

using .Index
using .Form

@page("/", Main.App.Index.ui, model= Main.App.Index)
@page("/form", Main.App.Form.ui, model= Main.App.Form)

end

@essenciary
Copy link
Member

essenciary commented Jan 10, 2024

I think we can improve on this, ex in the @page macro, if we pass the model explicitly, we should maybe automatically enable Stipple.ALWAYS_REGISTER_CHANNELS[].

Or better understand the difference between explicitly passing models or not... Something behaves differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants