Fork me on GitHub

Hi. I just noticed that reg-event-fx ignores db alterations send via {:db alt-db if (and only if) it dispatches to another event via :fx [[:dispatch [::dlg-events/set-dlg {:dlg dlg ...} . As soon as I comment out the :fx part of the return map, db is handled normally, means the returned alterated form gets applied. Somehow :fx [[:dispatch is designed to interrupt here. Intentionally? If so, why? Thanks + best regards!


I cannot reproduce it with re-frame 1.2.0. Can you create and share a repo with a minimal reproducible example?

🙌 1

Pls ignore my question. As it is so often the case, the problem was produced right before the monitor.


@U2FRKM4TW Sorry(!!!) for stirring things up. And Thanks for your quick repsonse!!!!!


Ah, a good old case of PEBCAC. :) No problem.


Good to hear that is a false alarm, that would be a horrific bug 😱


Folks, I am well and truly stumped. I am adding re-frame-10x version 1.0.2 to my project, but when I compile it, the compile aborts with the error Invalid :refer, var day8.reagent.impl.component/patch-custom-wrapper does not exist in file resources/public/js/out/day8/re_frame_10x.cljs. When I look at the source on github, though, patch-custom-wrapper is plainly there.


To make it more stump-provoking, if I look at resources/public/js/out/day8/reagent/impl/component.cljs, I find a file that contains two commented-out definitions for original-create-class and create-class, instead of the last three definitions as they appear in the version we find in github.


so it is missing from the file, but where the heck is this crippled version coming from? I’ve checked the history for the file on github, and there are only 2 commits, neither of which contain the crippled version that I’m seeing


I am very suspicious of the path resources/public/js/out/day8/reagent/impl/component.cljs. Where does it come from? Why is js/out on your classpath?


It’s not, I’m deducing it from the error message. I’m assuming that’s just a temporary build directory used to construct main.js?


Well, it is on your classpath - otherwise the compiler would've complained about some other path. It might not be on the lein process classpath, but it is there for the build process.


True. Temp classpath maybe? It’s got a directory tree that matches the list of dependencies for my cljsbuild, and each file in the tree has foo.cljs, foo.cljs.cache.json, foo.js and (where foo.cljs was the original file in the dependency).


I can understand that directory being there. I don't understand it being on the classpath. What's your project.clj?


:cljsbuild {:builds
               {:source-paths ["src/cljs" "src/cljc" "env/local/cljs"]
                :figwheel {:on-jsload "infusion.core/mount-components"}
                {:main ""
                 :asset-path "/js/out"
                 :output-to "resources/public/js/main.js"
                 :output-dir "resources/public/js/out"
                 :source-map true
                 :optimizations :none
                 :infer-externs true
                 :pretty-print true
                 :closure-defines {"re_frame.trace.trace_enabled_QMARK_" true
                                   "day8.re_frame.tracing.trace_enabled_QMARK_" true}
                 :preloads [re-frisk.preload
                 :external-config {:devtools/config
                                   {:features-to-install [:formatters :hints]}}}}}}


Do you have any other mention of :source-paths in the whole file, not just under the :cljsbuild key?


Oh hey, I reposted a generic version of the question in #clojurescript and thheller gave me a super tip. He had me fire up a repl and do

user=> (require ')
user=> ( "day8/reagent/impl/component.cljs")
#object[ 0x6d55862e "jar:file:/Users/marknutter/.m2/repository/re-frisk/re-frisk/1.5.0/re-frisk-1.5.0.jar!/day8/reagent/impl/component.cljs"]


Apparently re-frisk is the culprit here.


Oh, interesting. I still have no idea why the compiler would complain about resources and not the jar or the resource name.


Yeah, I might have a wonky cache somewhere or something.


Definitely a weird one tho.


Also might be worth it asking the author of re-frisk why he bundles day8/reagent/impl/component.cljs in there.


And especially why he bundles a broken version of it.


It might not be broken for his use cases. But re-using namespaces is not great.


Looks like re-frisk is re-using our reagent monkey patches from re-frame-10x to get internal tracing. It is fine to use the code (10x is MIT license after all), but they should be renaming it like re-frisk.inlined-deps.day8.... or similar, otherwise this is going to burn people like yourself @manutter51 who have run both in the same project which is a totally valid use case that is even supported by the official re-frame-template.

👍 1

sorry about that, will fix it soon


@manutter51 fixed [re-frisk "1.5.1"]


@manutter51 does the resources/public/js/out/.../*.cljs file actually exist on disk?


or is that just in your browser devtools?


Yeah, it’s there. Check out the threaded replies, I think I have a good lead now.


Hi, I'm struggling with internationalization. I have based my website on a value in the db. I wanted to get the accept-language value to be able to set the db value. Could you help me a little bit on how I'm supposed to do that? or a better way?


I'm using tumpura and have already understood the interest to add the wrap-ring-request, except I don't have understood how to get that in the re-frame/cljs world.


if it helps


Accept-Language is a request header - it's meant for a client to tell a server what language to use when serving the content. So, just serve the HTML with that language stored somewhere. In a <meta> tag, for example.


I'm using languages set via URLs. So if there's a request for /, I determine the language via the Accept-Language header, then redirect to e.g. /en/ - this way, people with different browser settings will still be able to share pages that use the same language.


And I have an explicit way on my websites to switch the language in a somewhat persistent way, because Accept-Language is not always accurate or preferred.


so 1) you don't use the db at all, if I understood correctly 2) my issue is there, when I would need to retrieve the Accept-language in your / page for instance, I did not understood how to do that, I don't have any request clearly stated in my re-frame app. And when I look for re-frame and request, I find some discussion about effects


I use app-db, but the initial value comes from a <meta> tag. You look for Accept-Language on the server side. It doesn't matter what makes the request and how exactly it was made.


ouch, I was definitely far from that solution