Skip to content

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

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

Open
jochenkrattenmacher opened this issue Nov 2, 2022 · 2 comments

Comments

@jochenkrattenmacher
Copy link
Contributor

jochenkrattenmacher commented Nov 2, 2022

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
@hhaensel
Copy link
Member

hhaensel commented Nov 6, 2022

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.

@jochenkrattenmacher
Copy link
Contributor Author

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 👀

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

2 participants