Fork me on GitHub
#re-frame
<
2018-05-10
>
tianshu00:05:13

@danielcompton Hi, We can use Reagent. In React Native, things you can use are all React component, these component are mapping to the real native elements. at the entry of program, call React Native API to register a component(a plan React component) instead of rendering it to a dom node.

tianshu00:05:36

I think re-frame-10x should work properly, because it already be used in status-im project. It must be I missed something important I think.

danielcompton00:05:55

K, we don't use RN at all at Day8 so will probably need help from outside for any changes to support it better

troglotit08:05:53

I want to read value from db once in component init, then subscribe with param calculated based on first value. So should I do it like this:

(defn my-comp []
  (let [first-value @(rf/subscribe [:first-value])]
    (fn []
      (let [computed-subscription @(rf/subscribe [:second first-value])] 
...

troglotit08:05:30

Oh, I’ve forgotten about reg-sub-raw

troglotit11:05:16

Is it considered common to use subscriptions not in components, but in events? To use them as like sort of “cursors” into my data?

danielneal12:05:41

if you do, you'll probably need to use https://github.com/vimsical/re-frame-utils/blob/master/src/vimsical/re_frame/cofx/inject.cljc to make sure the subscription clean up happens properly

jco12:05:58

How can I enable jQuery/Bootstrap for my application? I keep getting the error Bootstrap's JavaScript requires jQuery. I've tried including jQuery before the Bootstrap JS, but it doesn't help.

tianshu13:05:14

@danielcompton any suggestion to debug where is going wrong? by watching the frames of websockt(re-frisk-remote server), I know the trace data has been sent correctly. I want to investigate this problem.

gadfly36114:05:58

Hey all, just made re-pollsive: a library to handle polling events for re-frame https://github.com/gadfly361/re-pollsive

🎉 12
👍 4
MegaMatt16:05:28

I'm trying to think of a way to show a loading indicator if :loading is set longer than 500 and if it shows at all then show it for at least 1500 ms. Any ideas on how to do this the re-frame way?

MegaMatt16:05:35

oh, that looks like it will help

MegaMatt17:05:12

Anyone know if a negative number is fine in the ms? will that just dispatch immediately?

mikerod18:05:35

@matthewdaniel it is an impl detail that isn’t documented, but looks like the ms arg goes through to js/setTimeout

mikerod18:05:26

Isn’t 0 more common for the case you are saying?

mikerod18:05:42

It isn’t truly immediate, but it is “soon” etc

mikerod18:05:13

ie something like:

If this parameter is omitted, a value of 0 is used, meaning execute "immediately", or more accurately, as soon as possible.
via https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout doc on delay arg.

jco19:05:26

I'm getting a lot of render false {:loading? false, :error nil, :choices [], :id 0, :timer nil} in the console log, when using re-com's single-dropdown component. Some deep reagent callstack behind it, which doesn't tell me much. Has anyone seen this?

lwhorton19:05:40

i’ve been concocting an “event blocker” interceptor and I wanted to get some feedback if anyone’s interested… is this a stupid idea? is there a much better way to do this? https://gist.github.com/lwhorton/6ae745eca14a02796fa511479bfb3907

lwhorton19:05:41

the use case is a user is working on a multi-part form, or something complicated where they don’t want to lose lots of input if accidentally/intentionally clicking away. it’s essentially the canonical “are you sure you want to leave the page without saving?” message, done via an interceptor

lwhorton20:05:39

i guess a problem with this implementation is that :allowed-these-events can grow really large, particularly if there’s background tasks… at which point it’s almost useless if you have an async handler return at some point, or a websocket connetion spewing events, etc. hmm.

lwhorton20:05:35

i think it would be more helpful to have a :catch-these-events almost like the re-frame-forward-events lib, but instead of “see this event and then do that”, it should “see this event - kill it, and do this instead”.

sveri21:05:09

What is the idiomatic way to structure a app state when editing elements. So I have a list of users and want to edit one. I see two posibilities: 1. add the id to edit to the app state like so: {:users {:edit 23 :all [....]}} 2. add the user map that should be edited into the app state: {:users {:edit {:name "foo" :id 23} :all [....]}}

sveri21:05:48

I think that article: https://purelyfunctional.tv/guide/database-structure-in-re-frame/ answered my question 🙂

👍 16
mikethompson22:05:09

@mikerod @matthewdaniel Annoyingly, if you setTimeout with 0, it will still be 3ms to 4ms.

mikerod22:05:38

@mikethompson yep “as soon as possible” hah