Stipple.jl icon indicating copy to clipboard operation
Stipple.jl copied to clipboard

Stipple.init: vue_app_name does not affect HTML root element name

Open jochenkrattenmacher opened this issue 3 years ago • 2 comments
trafficstars

If I choose a custom name for my vue app via supplying the vue_app_name kwarg to Stipple.init, the Genie app doesn't work, because the generated HTML root element (as created by the page() function) still has the standard name. This results in a javascript error (#xyz not found)

I believe the problem lies with the vm() = root() function in Elements.jl, which does not refer to what was previously supplied to Stipple.init:

function root(app::M)::String where {M<:ReactiveModel}
  Genie.Generator.validname(typeof(app) |> string)
end

jochenkrattenmacher avatar Nov 02 '22 13:11 jochenkrattenmacher

That sounds like the root() cause, indeed! Have you tried overwriting root(), e.g.

Stipple.root(::MyModel) = "my_highly_desired_alternative_name"

Please let me know if that helps.

hhaensel avatar Nov 06 '22 23:11 hhaensel

close enough :)! This helped:

function root(app::Type{M})::String where {M<:ReactiveModel}
    "I_am_so_happy_I_can_use_this_name"
 end

(needed to overwrite the Type{M} function)

If it only always was that easy to get to the root of the problem 👀

jochenkrattenmacher avatar Nov 07 '22 15:11 jochenkrattenmacher