This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-18
Channels
- # aws-lambda (3)
- # beginners (57)
- # boot (3)
- # bristol-clojurians (1)
- # cider (38)
- # cljs-dev (23)
- # clojure (35)
- # clojure-italy (32)
- # clojure-nl (6)
- # clojure-spec (35)
- # clojure-uk (132)
- # clojurescript (34)
- # cursive (22)
- # data-science (1)
- # datomic (54)
- # devcards (1)
- # duct (5)
- # editors (7)
- # euroclojure (4)
- # fulcro (40)
- # graphql (1)
- # hoplon (6)
- # immutant (5)
- # jobs (1)
- # off-topic (22)
- # om (1)
- # planck (17)
- # portkey (1)
- # protorepl (12)
- # re-frame (97)
- # reagent (67)
- # reitit (16)
- # ring-swagger (1)
- # shadow-cljs (98)
- # spacemacs (8)
- # sql (20)
- # tools-deps (60)
It might be that ensuring that transformations keep cursor in place is something that React doesn't do
I've been using cljs-react-material-ui, but does that matter? I've also been waiting for it to switch to muiV1, but are there any problems in using mui directly?
@juhoteperi we can always add a transform-fn arg to the adapt fn
Or pass an update-fn to the on-change handler
Which updates this.state
@pesterhazy Doesn't help. Even if the this.state contains transformed value, cursor breaks.
Breaks in Reagent sense. It also is broken in React, but Reagent has additional logic to fix this.
And this is not even React problem, it is DOM problem.
When you set value in DOM input, the cursor moves to the end if the value is different than one already in DOM
@pesterhazy If you want to work on this more, this PR has only the adapt-input-component, without replacing existing Reagent logic: https://github.com/reagent-project/reagent/pull/381/files
@juhoteperi interesting, I didn't know that
honestly changing the value is a pretty niche use case
so it only affects few people. But I'm sure some people rely on it
Yes, but it is one that is supported by Reagent inputs currently so that can't be changed
Agreed, breaking the API is not rich-eived well
But we can always add it as an additive change, as per your PR
It would be good to get some feedback in production before adding it to the reagent api (if that's something we're considering)
Or someone can provide it as a separate lib. I'm still unsure if I want to have this in Reagent. Maybe. Yeah more testing is needed.
I could add it to my reagent helper library https://github.com/pesterhazy/recalcitrant
I think I like the other fix better for Material-UI, but this works for other libs also.
And then if people end up loving it, we could merge it into Reagent proper
I've got an issue where some code works in dev, but does not work with advanced optimizations turned on. using cljs 1.9.946. How do I go about debugging this?
@doubleagent are you getting an error message? the typical problem is missing externs
no error message and it doesn't appear to be missing externs. Problem is here: https://gist.github.com/doubleagent/208b5f305f7d5e9e332750debd28c91b#file-barf-cljs-L186
there's a pagination component on the page which is supposed to update a ratom and trigger a table re-render
in advanced compilation i never see the table re-render
the most obvious candidate is the .-activePage
not working as expected. i’d throw in some logging statements to isolate the issue
Has anybody had the experience of porting a hefty re-frame app to reagent? That sounds dumb even as I write it. 🙂 Maybe I should start from the JS version that just relied on the equivalent of ratoms.
My goal is to learn reagent and then React itself.
Yes, and my Lisp app is 486 assembly language. :0
you’d either end up recreating the functionality of re-frame or you’d just gratuitously re-engineer the state management of the app
I am definitely accustomed to the solitude of the lunatic fringe.
what would be really useful is to go find a popular react tutorial (like todomvc) and write a step-by-step blog post that shows how to do the react tutorial in reagent
that would serve your purposes. i think learning the state management before learning the basics is a hard way to go about it
I love how reagent TodoMVC turned out.
Yeah, I think I will start from the JS version since I would be discarding anyway the re-frame-ese. Thx for the sounding board!
@lee.justin.m yeah, you called it
thanks.
@lee.justin.m i guess a general rule in this situation is to suspect js object props?
a couple of things: this might be helpful https://clojurescript.org/reference/advanced-compilation#fixing-advanced-compilation-issues
if you use shadow it works better and the warnings are easier to use as is type hinting
I've got a follow-up question
I added some logging, so I could verify that the property was being given a different name
It displays like I expect
Shouldn't I see something like a: 2
in the console if it were being minified?
i’m not 100% sure of what i’m looking at, but i think the problem is that the library you are using isn’t getting minified but your code is
if they were both being run through advanced compilation it would presumably work because the symbols would match
interesting
alright, thanks. I think I get it now 🙂
It's a feature available in the clojure layer for spacemacs
According to this (https://stackoverflow.com/questions/35527115/why-can-i-not-access-this-js-objects-props-in-clojurescript#35535118) the solution is to use goog.object/get
. It works, but I wonder if there's a better solution. In particular I doubt that I am compiling everything correctly.
so you can definitely just avoid the issues by using string accessors (or a library like cljs-oops
)
or you can turn on externs inference + warnings and then type hint when the inference fails
cool, thanks