ornament icon indicating copy to clipboard operation
ornament copied to clipboard

Ornament component with over 19 child throw arrity exception on ClojureScript

Open JohanCodinha opened this issue 3 years ago • 4 comments

(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.

JohanCodinha avatar Nov 11 '21 00:11 JohanCodinha

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

plexus avatar Nov 11 '21 06:11 plexus

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)` 

JohanCodinha avatar Nov 11 '21 07:11 JohanCodinha

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 avatar Jan 01 '22 17:01 plexus

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

plexus avatar Jan 25 '22 21:01 plexus