This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (31)
- # beginners (8)
- # boot (277)
- # cider (9)
- # cljs-dev (15)
- # cljsrn (2)
- # clojars (22)
- # clojure (132)
- # clojure-russia (65)
- # clojurescript (53)
- # datavis (23)
- # datomic (1)
- # hoplon (9)
- # ldnclj (9)
- # lein-figwheel (1)
- # leiningen (2)
- # off-topic (3)
- # om (72)
- # proton (1)
- # quil (2)
- # re-frame (23)
- # reagent (33)
- # ring-swagger (2)
- # yada (5)
So I’m noticing that as of recently re-frame has started complaining when I do Chrome’s “Empty cache and hard reload” option. I generally make a habit of doing this while testing webapps, but now when I do it, re-frame tells me that my event handlers don’t exist. I can ‘fix’ it by doing a normal refresh, but this seems weird. Anybody experience this?
I guess this is some timing issue in your code. Maybe you are registering your handlers in some async callback or delayed. And the fact that cache is cold causes this callback to fire later than usual. I would recommend to pause re-frame event processing until you register all your handlers
As far as I know, I’m registering them the normal way:
require-ing the ns in core.cljs
And my handlers.cljs is simply one def (standard-middleware) and a series of
aren’t you calling dispactch in some other place, before handles.cljs code gets actually evaluated?
I think good approach is to avoid any sideeffect in namespaces, you should implement some
init! function where you setup your re-frame and then call first dispatch, this init function should be called from your core ns as a side-effect, that is the only place where you call a fn when loading ns
keep in mind that goog.base is requiring namespaces asynchronously, this might play a role, you are not in control when those side-effects will run
I’m using re-frame with pushy (which uses HTML5 push state and lets me have URI’s w/out the #). If I type in a URI into the browser address bar of course that gets sent to the server where my app is served from. The server then decides it doesn’t know about the URI, which is true because its a client side URI. How do I deal with that. I presume I would need to send the requested URI back in the response map and somehow then let the client deal with re-creating app-db and routing the client back to the right place. This seems like a common scenario. Is there a pattern for this? Any examples? Am I even right in my assumptions?
I’m not familiar with HTML5 push state in detail, but I guess there could be some way how to prevent browser from requesting a new page on url change
Thanks for answering, and apologies for asking in the wrong channel. I agree this is not specifically a re-frame question. I know I can use URI’s with # in them, I just wanted to try w/out. I know its possible because @pupeno talks about it here https://carouselapps.com/2015/12/05/tour-of-the-source-code-of-ninja-tools-part-2/. And yes thinking about it there’s no need to send back the requested URI. I’ll keep plugging away, thanks again.
@simax99: I would think pushy should give you some docs/examples how to deal with HTML5 push state w/out #