This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-25
Channels
- # adventofcode (1)
- # announcements (1)
- # beginners (244)
- # calva (20)
- # cider (11)
- # cljs-dev (34)
- # clojure (50)
- # clojure-spec (1)
- # clojure-uk (3)
- # clojurebridge (1)
- # clojurescript (21)
- # code-reviews (1)
- # cursive (19)
- # events (1)
- # expound (1)
- # fulcro (65)
- # hyperfiddle (6)
- # luminus (3)
- # nrepl (3)
- # off-topic (23)
- # protorepl (4)
- # re-frame (18)
- # rum (11)
- # shadow-cljs (77)
- # spacemacs (8)
- # tools-deps (2)
- # unrepl (1)
- # vim (2)
Doing my x-monthly try-again with Fulcro and devcards. Seeing in a warning devcards.core/dom-node* is not public
when calling (defcard-fulcro ,,,)
@grzm Not sure. version of devcards? We’ve largely moved from devcards to workspaces (as in the new lein template), but I can’t see why it would stop working unless the latest devcards changed something.
devcards 0.2.6. Yeah, I checked out blame
in f.c.cards.cljc
and devcards.core
thinking something might have changed, but all looks pretty old. Not seeing where dom-node*
is referenced in f.c.cards
either.
Here’s a repro case, if you’re interested: https://github.com/grzm/figwheel-main-fulcro-devcards
@grzm change in clojurescript compiler. If you use the prior version of the compiler it works. CLJS is now warning about private, where it did not before. In order to make that macro work I had to access the bits of devcards that were private.
so, the current workaround would be to go back a version. I’ll see if there’s something else in devcards that I can use to make it work…if not, I can just copy the bits out I need.
Actually, I consider that a bug in devcards…Bruce’s own wrappers for Om Next and such output that same cljs function
This is from Devcards itself:
(defmacro om-root
([om-comp-fn om-options]
(when (utils/devcards-active?)
`(create-idevcard
(devcards.core/dom-node*
(fn [data-atom# node#]
(om.core/root ~om-comp-fn data-atom#
(merge ~om-options
{:target node#}))))
{:watch-atom true})))
([om-comp-fn]
(when (utils/devcards-active?)
`(om-root ~om-comp-fn {}))))
Nope, but dom-node
is. And since they’re macros the resulting code look like public calls?
so, if a macro emits a call to a private function in your ns, then it looks like you ns is trying to hit a private function, yes
so it was easy for lib authors to make mistakes that will now cause problems…which is why it is a warning and not a hard error
IMO, figwheel probably ought to go ahead and try to emit and run your code, even though it wants to show the warning
the new lein template, FYI, emits a shadow-cljs env with workspaces already set up. Figwheel main is nice, but I do prefer the non-reliance on cljsjs, the compiler cache and consistency improvements (I never have to clean source) and much better integration with js ecosystem.
I’m not emitting deps.edn just yet since it’s still alpha, but I do use deps myself and like it.
@tony.kay, hello 🙂 I just imported incubator latest in a new project and I'm getting a bad dep problem:
The required namespace "taoensso.timbre" is not available, it was required by "fulcro/incubator/ui_state_machines.cljc".
@wilkerlucio Give me a minute, I’ll push an update without that dep
no worries, for now I just added the dep, just letting you know the issue 😉
0.0.19 on clojars. I also removed the use of Defn for the moment, and added two (undocumented) helpers to state machines:
(apply-action env mutation-helper*)
which can use a fn of state-map to apply some mutation helper in a SM.
(get-active-state this asm-id)
Read the “current state name” from an active state machine using a UI component (this).
cool, thanks, since you are there, what you think about one fn to pull multiple aliases at once?
@tony.kay like a select-keys
version of alias-value
(defn alias-values [env values]
(reduce
(fn [out key]
(assoc out key (fsm/alias-value env key)))
{}
values))
There’s already aliased-data
@wilkerlucio
cool 🙂
Anyone got an example of how to wrap a semantic-ui form-field
using Input
as controller?
I can use the basic version, but there are a few problems.
It prints a warning and the input cursor always jumps to the end of the line.
Using :default-value
solves the input cursor jumping but introduces other problems because of unmanaged.
@andreas862 it’s a bit tricky, and basically involves writing a wrapper that uses component local state tricks. Any system that does managed inputs through a round trip outside of component-local state is going to exhibit that problem.
I leveraged the wrapper that Fulcro itself uses to make the main input types “work right”
that technique should work for any libraries that make react components that wrap inputs.
I can get it to work with a basic input - But still get warnings about changing a controlled input to an uncontrolled.
but I don't know what to do in case of a form-field in a form.
Like (com/ui-form-field {:controll Input :value text-attr ...})
Where a class is passed as the controller, suppose it must be wrapped somehow
that warning is about passing nil as a value to an input, which you should never do. Class passed as any kind of param is just a react class. In general in FUlcro you won’t have controllers or delegate to stateful things like that…kind of an antipattern.
Right, just build from simple block and do logic in cljs? Sounds like a good idea. Thanks!
About the warning, are you talking about the :value
prop?
I get the same varning if I do :value (or v "")
yes I am, and you should look at other inputs in that case, becaseu that is what it means
is this the varning you mean: "`value` prop on input
should not be null".
That is what I get if I pass in a nil
as :value
.
The warning I get is: Warning: A component is changing a controlled input of type text to be uncontrolled
.
I have checked and devcards in semantic-ui-wrapper produces the same warning. (semantic-ui-wrapper triggers warning at first render, my warning is the first time I trigger onChange.)
Happens because the wrapped input has a value="something"
that gets removed
I think
Hello! I've got a question about the keyfn
for setting React keys. I'm using an id like so: (prim/factory notebook {:keyfn :id}))
. :id
is an integer set from the database, or temporarily a prim/tempid
if just created. Today I noticed that if I create a new entity with a prim/tempid
, then the component will be unmounted/mounted as this tempid resolves to the real id returned from the server. This means I cannot be sure that code in :initLocalState
is only run once. I verified this by changing to use an index as key, passed down in prim/computed
, and then it only renders the entity once. I was wondering how people normally handle this? Or if I misunderstood something? Would ideally not use an index here.
@pontus.colliander I use a client created UUID for idents and :keyfn
s on the client
all my models have and :entity/id
key that is just a random UUID, so then i don’t have to ever worry about tempids