Fork me on GitHub

How do you show the page is working, for example, when you are waiting from an ajax call, so that that one time it takes long it doesn’t look like the page died?


@pupeno: having marker in app-db? like :ajax-loading? and render smth special if true. set and unset in handlers


@ul: yes, the marker is fine, although I’m slightly concern about paths that leave the marker on accidentally. But I mean, how do you normally display it? any reusable component? I don’t want to flash a spinner in the middle of the page for each ajax call, that can get annoying.


flash it in the corner, or use toatr, or what you like. another useful thing is to make :ajax-loading not boolean, but timestamp when set


you can wait a little before showing spinner


if ajax call is fast, nothing blinks


@ul: yes, I gather I’m not the first one to want this, so I was wondering if there was something reusable out there for this.


i'm not aware about reusable, i just insert one-line conditional render in the places where spinner is to be


it is div with preloader class, everything else is done by css framework


I’m starting with re-frame and I noticed this. I have a little address book that displays a list of people, so in the db I store a list of people and display it. This is loaded from the server on an ajax call. When you click on a person, the record for that person is displayed. I’m using secretary so I link to /#/person/john-doe and that dispatches to a handler that sets active-panel to :person-panel.


But then I need to have, in the db, which person is being displayed. Right?


My first though was: :current-person in the db, but as people move to other parts of the app, this would be left over and could interfere with other parts of the app that also have a current-person.


So, it feels like {:people … :current-person} in the db has a mix of two things: :people is data retrieved from the server, but :current-person is something akin to current-pane-state. I’m thinking of putting it in :current-pane-state, so the next pane will nuke it. Does it make sense?


maybe current person could also be something local to the person-shower view.


I have a state per route. That way, I can reset the state everytime the route is triggered.


roberto: what’s the advantage of state per route instead of state of the current route?


escherize: what would that look like?


I don’t understand what you mean by state of the current route…. but basically, I find it easier to reset the state of the route I’m going into if it contains its own state.


so stuff like :is-loading? gets reset


roberto: oh, are you talking about showing loading progress, not my last question about state.


well, i have this form page with a lot of info for some item. I actually have a (subscribe [:current-item]) that gets cleared after the form gets filled out and does its job, but that could have been accomplished the same way using (r/atom {:item-attr "thing" .. }) since I didn't need the item info anywhere else


This is not local to a form though. This is what the page should show based on the URL.


Has anyone written anything up on how they have integrated re-frame with Secretary, Silk, Bidi, or any other routing libraries?


@shaun-mahood: are you looking for something specific? I've Secretary and re-frame working in a very simple side project:


@arathunku: Not looking for anything too specific. I've got things working in Secretary but am not totally happy with it - seems like getting it to work nicely isn't as clean or easy as it should be and wanted to look at how others have done things. Trying to get it to work nicely with figwheel reloading, the initial load of app-db data from ajax calls (depending on which page is first hit and supporting bookmarking), and general route dispatch with links within the app.


Oh, ok. I probably should have written down how I've done it. I remember I had a problem with figwheel reloading and views refresh in reagent.


I've got it mostly working, but there are some edge cases that I just find annoying and think will cause problems later down the road. Thinking I might have to spend a bit of time figuring it out, then get it working in each of the libraries and write it up for the wiki. Been planning on doing it for secretary but just not happy with my results yet.