Giter Site home page Giter Site logo

Comments (6)

MariusDrulea avatar MariusDrulea commented on June 11, 2024 1

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

from genie.jl.

MariusDrulea avatar MariusDrulea commented on June 11, 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.

from genie.jl.

PGimenez avatar PGimenez commented on June 11, 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

from genie.jl.

essenciary avatar essenciary commented on June 11, 2024

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

from genie.jl.

essenciary avatar essenciary commented on June 11, 2024

@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

from genie.jl.

essenciary avatar essenciary commented on June 11, 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.

from genie.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.