Fork me on GitHub
#re-frame
<
2016-10-20
>
olegakbarov10:10:17

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?

elahti11:10:34

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

limist12:10:46

@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

mattly17:10:05

@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

olegakbarov18:10:28

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

olegakbarov18:10:35

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

mattly18:10:05

@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?

mattly18:10:51

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

mattly18:10:38

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

olegakbarov18:10:16

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

mattly18:10:19

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

olegakbarov18:10:43

o, cool, i’ll give it a look

symbit20:10:11

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.

superstructor21:10:00

@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 ?

limist22:10:28

@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?

superstructor22:10:59

@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] ?

superstructor22:10:15

@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 ?

limist22:10:46

@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...

limist22:10:47

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.