GenieFramework / StippleUI.jl

StippleUI is a library of reactive UI elements for Stipple.jl.
MIT License
82 stars 15 forks source link

chat message doesn't render #88

Closed AbhimanyuAryan closed 10 months ago

AbhimanyuAryan commented 1 year ago

DEMO:

using GenieFramework
@genietools

@app begin
  @out textmsg1 = "['hey, how are you?']"
  @out textmsg2 = "['I am good']"
end

function ui()
  [
    Html.div(class="q-pa-md row justify-center",[
      Html.div(style="width: 100%; max-width: 400px",[
        chatmessage(:textmsg1, name="abhi")
        chatmessage(:textmsg2, name="adrian")
      ])
    ])
  ]
end

@page("/", ui)

Server.isrunning() || Server.up()

now the code is correct and the output html is also correct. I can see in vue console but nothing renders on screen

asdfdsafds
AbhimanyuAryan commented 1 year ago

@hhaensel have you seen this issue before. I am completely lost why is this happening. Could be CSS rendering and style issue? I am debugging this but if you know what's happening please let me know

hhaensel commented 1 year ago

You need to bind vectors of String:

@app begin
  @out textmsg1 = ["hey, how are you?"]
  @out textmsg2 = ["I am good"]
end

function ui()
  [
    Html.div(class="q-pa-md row justify-center",[
      Html.div(style="width: 100%; max-width: 400px",[
        quasar(:chat__message, text = :textmsg1, name="abhi", sent = true)
        quasar(:chat__message, text = :textmsg2, name="adrian")
      ])
    ])
  ]
end

route("/") do
  model = @init
  page(model, ui()) |> html
end

EDIT: I had to change the routing, because somehow page always wants to cache the page and doesn't understand the quasar() output. @essenciary not sure where this happens and how to get around this.

hhaensel commented 1 year ago

image

hhaensel commented 1 year ago

Why is this? (Not necessarily to @AbhimanyuAryan but to everyone who is developing a new feature which is not yet incorporated in StippleUI and hasn't got a lot of experience with Vue.js) The demo code on quasar looks like this:

<q-chat-message
        name="me"
        :text="['hey, how are you?']"
        sent
      />

Note that the text is preceded by a colon which means that the content is evaluated as javascript expression in the name space of the vue model. That means that the content is an array of strings. If you would have written the text explicitly as in the example, you would have seen a correct result. But if you bind it to a variable that variable needs to contain an array of strings.

hhaensel commented 10 months ago

@AbhimanyuAryan please close this if you are fine with the responses