Fork me on GitHub
#fulcro
<
2018-06-15
>
hugh.jf.chen11:06:39

@chrisjswanson I remember I'd the same problem when using semantic-ui-react with reagent and I fell back to bootstrap input.

timovanderkamp13:06:25

Is there a specific reason why the key for a fulcro-form (`:fulcro.ui.forms/form`) is not prefixed with ui? So that it won't be passed to the remote?

Chris Swanson14:06:07

@hugh.jf.chen Yea, I was about to go that way too. As it turns out, I realized, I don't actually need to use a controlled input. If I just use "defaultValue" instead of "value", I can still keep the contents of the text field tied to the value in the app db. Because whenever a key is pressed I trigger a mutation of app db for the field, and the component's subscription will then cause a render. I still don't really understand why this works while a "true" controlled input has the cursor bug. But for anyone with the same situation, maybe just changing to use "defaultValue" will help.

tony.kay15:06:27

@timovanderkamp Just trying to keep it from conflicting with other parameter names by using FQ namespace. You point about the remote it an oversight 😕

timovanderkamp15:06:28

@tony.kay i noticed that the initialized form was removed after a second load, because the form key was queried but returned nil. Thats why I was asking. It can easily be prevented though by using the without load-paramater

tony.kay15:06:05

@timovanderkamp Technically you should re-initialize the form after a load, since the "saved" pristine state is wrong

timovanderkamp15:06:37

Ye that is also what i thought about after asking this question

timovanderkamp15:06:15

Thanks for the clarification

afhammad21:06:57

whats going on here?

18 | (defsc Transaction [this {:keys [txn/amount]}]
-------^------------------------------------------------------------------------
{:cause #error {
 :cause "Invalid arguments"
 :data {:reason "[] is invalid."}
 :via
 [{:type clojure.lang.ExceptionInfo
   :message "Invalid arguments"
   :data {:reason "[] is invalid."}
   :at [clojure.core$ex_info invokeStatic "core.clj" 4739]}]

OliverM22:06:57

@afhammad what does the rest of your defsc look like? There's not enough in that error msg to tell

afhammad22:06:39

@oliver.mooney

(defsc Transaction [this {:keys [txn/amount]}]
  { :query [:txn/id :txn/amount]
    :initial-state (fn [params] {:txn/id (:id params) :txn/amount (:amount params)})
    :ident [:txn/by-id]}
  (dom/li
    (dom/div txn/amount)))

afhammad22:06:02

my first go at fulcro, and haven’t touched clojure in a while, please point out if anything looks silly

hugh.jf.chen23:06:25

@chrisjswanson I had opened a report to semantic-ui-react but they think the component works expected and close my report immediately

claudiu23:06:21

@afhammad looks like the :ident should be :ident [:txn/by-id :txn/id]