GenieFramework / StippleUI.jl

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

notify doesn't work with Dict #123

Closed yakir12 closed 4 months ago

yakir12 commented 7 months ago

I'm trying to notify the client about some error. The error message I compose may contain a string representation of a Dict. It would seem that if the message contains the Pair operator, =>, then it doesn't display on the client's side. MWE:

msg = "this works"
notify(model, msg, html=true)

msg = string(Dict(() => ()))
notify(model, msg, html=true) # this doesn't work
essenciary commented 7 months ago

@yakir12 you're saying txt instead of msg.

yakir12 commented 7 months ago

Oops (fixed), regardless, perhaps this illustrates the problem more clearly:

msg = "this works"
notify(model, msg, html=true)

msg = "this doesn't =>"
notify(model, msg, html=true) # this doesn't work
hhaensel commented 7 months ago

To me it's not really clear what goes on. It seems that there is some character checking even when html = false. Anyhow, notify seems to fail if the string contains "=>". So if you need to display "=>" make sure that html = true and replace ">" by ">"

hhaensel commented 4 months ago

@yakir12 I found the culprit. I had it on my list already quite some time ago, but had not realised that it was also the root cuase for this issue. So feel free to use "=>" from now on in your strings ...

yakir12 commented 4 months ago

Awesome thanks!