Fork me on GitHub
#re-frame
<
2016-05-03
>
aboekhoff15:05:28

I'm using re-frame with secretary and running into a small issue.

aboekhoff15:05:57

When I refresh the page at say "#/widgets/1/whatsits/42"

aboekhoff15:05:25

At app start I'm manually invoking secretary/dispatch! on the current token in history

aboekhoff15:05:50

That triggers a re-frame handler that updates the name of the current page to render

aboekhoff15:05:15

but it seems that it misses a few cycles, because it always starts rendering the default page for a few ms then jumps to the correct page

aboekhoff15:05:47

Is there a canonical way to make sure that all of the routing logic is setup and triggered correctly before starting rendering that I'm missing?

nfisher16:05:40

@aboekhoff: out of curiosity are you using the luminus template?

aboekhoff16:05:23

@nfisher: I started with the re-frame frontend only template. I think that might be my problem. I probably need to init the db, init the routes, and only then hook the navigation. I'll give that a try tonight. Thanks!

nidu17:05:07

@aboekhoff: Do you use accountant.core/dispatch-current! somewhere? In my understanding that's what triggers route on startup.

aboekhoff17:05:00

@nidu Just using plain secretary. Definitely targeting users with older browsers so HTML5 history is off limits for now. I think my problem is incorrect ordering of side-effects during init.