reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Unknown prop `visible?` #114

Closed hosiawak closed 7 years ago

hosiawak commented 7 years ago

I upgraded reagent to 0.6.0 and now getting warnings like:

react.inc.js:20209 Warning: Unknown propvisible?on <div> tag. Remove this prop from the element

:field appears too on container :divs. I guess React added some validation on props in 0.14 or later.

If that's the case would removing these props after parsing in reagent-forms be a good solution ?

yogthos commented 7 years ago

Yeah, React is more picky about props now. I agree the best approach would be to simply remove any custom props before creating the React component.

yogthos commented 7 years ago

Should be fixed by this commit https://github.com/reagent-project/reagent-forms/commit/a57c85dc02c388b1d6d0412e9a53e8075b835823

hosiawak commented 7 years ago

Yes, it's fixed, thanks :)

viebel commented 7 years ago

@yogthos I have the same issue on version 0.5.28 with :field

Warning: Unknown prop `field` on <input> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
yogthos commented 7 years ago

Looks like I missed a call to clean-attrs for some field. Any chance you could take a look?

viebel commented 7 years ago

Not in the near future

yogthos commented 7 years ago

no worries I'll take a look when I get a chance

bsteuber commented 7 years ago

@viebel I just ran into the same issue, but it turns out my problem was that I was using

(defn form []
  [:form ....])

instead of


(def form
  [:form ...
¸¸¸

Not sure if that might be your problem, too, but I thought I'd better point it out.
viebel commented 7 years ago

I am also using a function but I need it in order to make my form configurable.

Here is the a klipse snippet that demonstrates my code: http://app.klipse.tech/?cljs_in.gist=viebel/e6978ad5f2682c301afce85d95089fe2&container

But Klipse uses a minified version of React. Therefore, there is no warning.

Is there a way to enables the warnings with React minified?

yogthos commented 7 years ago

Using a function there should be fine. Since the function is evaluated before it's passed to bind-fields. You just can't pass a function as a parameter, as bind-fields uses postwalk, and requires a data structure to walk.

bsteuber commented 7 years ago

Actually an interesting thing happens: When I use reagent-forms 0.5.28 from clojars, my code still has the fields property warning. But when I pull the master branch and reference its src folder in my :source-paths it works. So are you sure you the most recent version is at clojars?

bsteuber commented 7 years ago

Oh, I'm silly - my local checkout had a modification, so I guess that means I fixed the bug :) Pull request coming up

bsteuber commented 7 years ago

Here you go: https://github.com/reagent-project/reagent-forms/pull/120

yogthos commented 7 years ago

Perfect thanks, just pushed out a new version to Clojars with the fix. :)