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

Ornament component with over 19 child throw arrity exception on ClojureScript #4

Open
JohanCodinha opened this issue Nov 11, 2021 · 4 comments

Comments

@JohanCodinha
Copy link

JohanCodinha commented Nov 11, 2021

(o/defstyled table-body-el :div
  {:display :grid}
  [:b {:border-right "1px solid grey"}])
  
(render-to-string [table-body-el
                               [:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1]])

This il throwing an Arrity exception, it won't if child element count is below 20.

(render-to-string [table-body-el
                               [:<>
                                      [:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1]
                                      [:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1][:a 1]]])

Wrapping the child in a [:<>] solve the issue but still it smell like a bug.
It looks like this is the issue.

@plexus
Copy link
Member

plexus commented Nov 11, 2021

Please include full stack traces and error messages when reporting an issue.

@JohanCodinha
Copy link
Author

Absolutely,

(o/defstyled table-body-el :div
  {:display :grid}
  [:b {:border-right "1px solid #e2e3e3"}]
  [:.cell {:border-right "1px solid #e2e3e3"}])

(try (render-to-string (into [table-body-el {:style {:border :none}}]
                             (map #(do [:b %])  (range 0 25))))
     (catch js/Error e
       (js/console.log e)))`
VM688:6 Error: Invalid arity: 26
    at Object.eval [as call] (core.cljs:2033)
    at Object.eval [as apply] (core.cljs:2033)
    at eval (component.cljs:91)
    at Object.reagent$impl$component$wrap_render [as wrap_render] (component.cljs:91)
    at Object.reagent$impl$component$do_render [as do_render] (component.cljs:117)
    at cmp.day8$reagent$impl$component$wrap_funs_$_render [as render] (component.cljs:46)
    at processChild (react-dom-server.browser.development.js:3450)
    at resolve (react-dom-server.browser.development.js:3270)
    at ReactDOMServerRenderer._proto.render (react-dom-server.browser.development.js:3753)
    at ReactDOMServerRenderer._proto.read (react-dom-server.browser.development.js:3690)` 

@plexus
Copy link
Member

plexus commented Jan 1, 2022

I see, seems this is a cljs-specific bug? Agreed that this needs fixing, we'll have to have a better look what the right approach is. Thanks for the report!

@plexus plexus changed the title Ornament component with over 19 child throw arrity exception Ornament component with over 19 child throw arrity exception on ClojureScript Jan 25, 2022
@plexus
Copy link
Member

plexus commented Jan 25, 2022

This is a ClojureScript issue. Minimal repro:

(def foo ^:foo (fn [& args]) )

(foo 1 1 1 1 1 1 1
     1 1 1 1 1 1 1 1 1 1 1
     1 1 1 1)

I've updated the title to reflect that this is ClojureScript-specific.

Upstream issue: https://ask.clojure.org/index.php/11514/functions-with-metadata-can-not-take-more-than-20-arguments

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