Fork me on GitHub
#re-frame
<
2017-09-25
>
Oliver George11:09:36

I'm looking for a way to avoid my ajax auto-complete glitching.

Oliver George11:09:45

As I type, new ajax requests fetch data.

Oliver George11:09:56

That means there's a period where no results are available.

Oliver George11:09:33

Seems a bit clunky.

Oliver George11:09:59

The behaviour I'd like is "keep showing the old list while I'm fetching new results"

Oliver George11:09:52

I'm doing a deal with the devil for now. Should be fine in my use case...

(r/create-class
    {:should-component-update
     (fn [_ _ [_ props]]
       (not (:loading props)))

yury.solovyov11:09:15

I don't see the reason why would you need to display empty results set

yury.solovyov11:09:12

there must me something cleaning the cache while next req is in-flight

Oliver George12:09:35

I use a sub for fetching results. The sub returns immediately with a loading state, then updates when values are available.

yury.solovyov12:09:41

so you're replacing prev. results with loading state when req is issued?

yury.solovyov12:09:01

why not have them side-by-side?

nooga13:09:57

Is there something akin to re-frame but for server side programs? I have a huge service that handles websockets, message queues and relatively big global, dynamic state. I can see some benefits in re-writing it using re-frame concepts.

nooga09:09:20

you mean core.async pubsub?

danielcompton21:09:23

@nooga a CQRS architecture is one way of interpreting re-frame on the server