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

Template snippet rendered differently on client and server #67

Closed
clyfe opened this issue May 8, 2016 · 2 comments
Closed

Template snippet rendered differently on client and server #67

clyfe opened this issue May 8, 2016 · 2 comments

Comments

@clyfe
Copy link

clyfe commented May 8, 2016

I have a (rum) hiccup-ish snippet in a template, that is rendered differently by the server side code than it is in the client side code, resulting in a React warning.

Sample code
;; component in cljc
(rum/defc app []
  [:input#topics {:type "text"}])

;; server in clj
(rum/render-html (components/app))

;; client in cljs
(rum/mount (components/app) node)
Resulting warning

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:

 (client) <input type="text" id="topi
 (server) <input id="topics" type="te
Some thoughts

Potential fix might be achieved by using something like https://github.com/amalloy/ordered on both clj and cljs sides, or sorted-map.

@nilpunning
Copy link

I too have run into this. Besides this minor issue switching my site from Reagent + Nashorn to Rum server side rendering is much faster and streamlined, way to go!

@tonsky tonsky closed this as completed in 790c93f May 29, 2016
@tonsky
Copy link
Owner

tonsky commented May 30, 2016

Fixed in 0.8.4

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

3 participants