Skip to content
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

dumdom.inflate/render fails for components without a name #44

Open
2food opened this issue Jul 20, 2023 · 2 comments
Open

dumdom.inflate/render fails for components without a name #44

2food opened this issue Jul 20, 2023 · 2 comments

Comments

@2food
Copy link

2food commented Jul 20, 2023

Like the title says, not specifying a component name makes inflation fail when doing SSR.

Example:
Simple component:

(defcomponent test-div [data]
  [:div (:text data)])

On server side (as part of html string):

(dumdom.string/render (test-div {:text "hello"}))

Then on the client side:

(dumdom.inflate/render (test-div {:text "hello"}) (js/document.getElementById "app"))

dumdom.inflate/render fails with error message "Invalid symbol: /test-div.0.".
Setting a name on all the components rendered makes it work, but I assume that it should work for unnamed components as well.

It seems like the auto-generated names like "/test-div.0" fail because of the leading slash. I also observed other cases were the generated name was a uuid, and these failed with the message "invalid number".

@cjohansen
Copy link
Owner

It looks like the namespace part is empty. What does the output of (dumdom.string/render (test-div {:text "hello"})) look like on the server side?

@2food
Copy link
Author

2food commented Aug 17, 2023

Hi! Sorry about the late answer.
(dumdom.string/render (test-div {:text "hello"}))
Returns:
"<div data-dumdom-key=\"&quot;/test-div.0&quot;\">hello</div>"

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