Fork me on GitHub

I wonder how you guys handle routing. I try to make a webserver which just passes routing down to client. Are there any examples of this?


we're just using secretary.core/defroute and re-frame.core/dispatch in combination


@superstructor Thanks for sharing re-frame-document-fx, i'm looking at the README and wondering: Would it support the use-case of having one top-level event listener that is able to catch all events happening on a page, both events emitted from Reagent Components (which seem to partly block event bubbling), as well as events started outside of said Components? tia for any clarifications


@olegakbarov I'm using bidi for route mapping / reverse generation, but am only using it for routes on the server; in my app a given route handler might require any number of active pages, and data is passed to the client in page load (in transit format in a script tag) which basically becomes app-db via dispatch


@mattly this sounds like something i’m looking for, any chance you can share some snippets?


haven’t thought about data fetching though … just trying to create sane development workflow at the moment


@olegakbarov TBH I'm not sure what help snippets would be - what's the problem you're trying to solve? loading up front-end components based on the state of the browser?


my app is also something of an odd case – I'm building an analytics tool and decided pretty early on that tying app state to URLs was impractical


so the screen one is on is derived from the app-state, which I actually compute server-side at page-load time


currently i’d like to pass all routing to client and do nothing server-side


I kinda gave up on the idea that I had to handle "routing" and instead solved for state-management


o, cool, i’ll give it a look


Have a re-com md-circle-icon-button with an up arrow and down arrow. on-click would like to move an item up/down by 1 item. Is there anyway to capture if the shift key is down while clicking to change the behavior? Like move item to the top/bottom.


@limist Thanks for the feedback. At the moment I havn’t needed or implemented anything like that. It just has side effects for things like rendering the root Reagent component to the DOM or changing the page title, and coeffects for things like getting the Location object as a map in your event handlers. I’d be happy to add new features. It would be helpful if you could explain the use case for listing to all events at the document level. What would you use it for ?


@superstructor For analytics purposes, e.g. to detect "interesting" events and let GA know about them. Possibly I don't understand the use-cases the library was meant to address; any chance of more documentation please?


@limist thanks thats interesting. Happy to add that 🙂 Just not sure about capturing all events including those that didn’t bubble. The initial release is what we are using for our own projects. Aiming to add more docs / features in the near future. So possibly something like :document/on-event [:my-handler] ?


@limist one other potential issue is performance concerns. I assume you mean listening to every global event handler; e.g. onmousemove ? Could produce a large volume of events ? Have you done this before ?


@superstructor It would be necessary to pre-define the events of interest, applying a filter to the stream of raw events. BTW, no worries if this use-case was not on the radar at all! Maybe a better approach is for us to see/read more docs/use-cases of what the library was meant to do...


To me it seemed that to do analytics on page with both server-rendered and Reagent elements, one would need two approaches working together: one to capture events from non-Reagent elements via event bubbling, and then another to note events fired from the Reagent elements.