Fork me on GitHub
Joel Holmes03:05:14

I’ve tried a couple of times to understand how to use clojurescript and re-frame. Just when I think I get it I run into things I can’t figure out. I have an app that I’m trying to write (in order to learn) and I can’t seem to get toggle to work. What am I missing? after clicking the button the icon won’t react. I get the put update.


@holmes89 you are very unlikely to get a response if you just throw an entire repo at us, with vague talk about some toggle not working. Please create a nice minimal case which doesn't work. Give us a bit of detail. Also, keep an eye out in the javascript console for warning and exceptions, etc. Perhaps review what is happening via re-frame-10x


yeah. i actually cloned this but i can't get it to run because its getting a carmine connection error. i need redis locally to run this so i can't help you. sorry

phronmophobic04:05:41 it looks like the read-book call both fires a toggle-read event and actually toggles the read property of the book. is it possible that it’s being flipped twice?


That’s right. Adding a watch and it gets flip flopped


I take it back. It does look like you'll get a response :-)

😂 8

i actually installed redis and cloned lol

❤️ 4

The new re-frame website is available here in a beta state.

🎉 44
Michaël Salihi07:05:43

Very nice, I like it!


I got a 404 on releases page but it has been fixed now Very nice result 👍 My only suggestion would be to increase a bit the line-height and/or font-size for the contents in .admonition.note


The writing itself is top-notch (seems to be based on the old, but I think hiding the code away 6 pages in is detrimental to the goal of making Re-frame more accessible to newcomers. Please consider putting the code up front.

👍 4

Very fine work! Who is the author of the prose? I quite enjoyed the writing style... :-)

Jakob Durstberger13:05:26

I want to use AWS Amplify in my react app. I’d like to check if the user is signed in and redirect them to their dashboard if they are. The library call currentAuthenticatedUser returns a promise so I am not quite sure how to hook that up to my routing. Ideally I don’t want the user to see the homepage and then be redirected after a delay. Could anyone give me some tips on how to do that properly?


I used promesa to handle the promise. When the promise arrived I updated app-db with whatever I wanted, which triggered the flow to the flow further.

Jakob Durstberger14:05:53

So let’s say you want to redirect the user from home -> dashboard if they are logged in. The flow would be * user lands on home -> kick off promise * user is on home <- promise returns after x seconds * redirect user to dashboard Wouldn’t that be annoying for the user?

Jakob Durstberger14:05:23

Sorry for the basic questions I haven’t implemented auth flows on website before 😕


Sorry, I my description was a bit terse. I my case the user lands on login screen. She enters username/password and after hitting enter I do validation after which (assumming it was successful) two things happen: 1. Event handler changes the screen state to :logging-in (I use FSMs as described and ). This activates a sub that changes Login button into a spinner. 2. Event handler returns

:login {:username username
        :password password
        :on-success :login-success
        :on-error :login-error}
Which is handled by reg-fx by calling AWS amplify with given data. When the promise eventually resolves it dispatches :on-success event. Event handler for the event advances FSM state further and dispatches a global event (e.g. ::global-events/user-logged-in that is handled by a top-level handler that advances the screen wherever you want.

👍 4
Jakob Durstberger13:05:07

Thanks, those posts also look interesting

Jag Gunawardana16:05:44

If you’ve ever looked at using kee-frame, then the new FSM (and other functions) work really well. I do something similar for login using urls and kee-frame FSM.

David Pham15:05:21

The resources tabs in the new website is behaving oddly.


@neo2551 corrected now (via a PR), many thanks.

David Pham19:05:01

My pleasure. I love the library it is really great to work with.


That's generous of you to say, thank you.

David Pham21:05:35

Is it possible to have a collection of all registered events?

David Pham21:05:46

In re-frame?


There's no API for it


But you can look into the private data within re-frame if you just want a quick hack


(keys (:event @re-frame.registrar/kind->id->handler))