Fork me on GitHub
#re-frame
<
2016-11-30
>
jorda0mega04:11:03

hi. newbie question. is there any reason why a reaction might be returning a state of null?

jorda0mega04:11:35

subscribers seem to be triggered and so was the event that sets initial state of the db

akiroz05:11:47

@jorda0mega are you getting an atom of nil or just nil?

vikeri08:11:11

@mikethompson I solved it by using set! instead of with-redefs.

mikethompson08:11:37

@vikeri out comes the howitzer !

curlyfry09:11:58

@mikethompson In 0.9.0 changes, you have: "Added experimental tracing features. These are subject to change and undocumented at the moment. By default they are disabled, and will be completely compiled out by advanced optimisations." I understand that docs are coming, but could you give a short explanation of what the features are and why they were added? 🙂

mikethompson10:11:47

@curlyfry we're trying to add the sort of tracing that higher level tools might need. But until we actually build those tools we can't be sure we have teh tracing correct. So we're just calling the low level tracing layer experimental for now

shem13:11:00

i'm thinking of writing an autocomplete that fetches the list of possible values from the server. i wonder if someone has already done this? I suppose this would be a case for coeffects? there's Lambda-X/re-complete but it isn't quite up to date

pesterhazy13:11:45

it's incomplete however; e.g. I didn't find a way to listen for "Enter" key events

pesterhazy13:11:50

but may be a useful guide?

pesterhazy13:11:01

personally I think a basic reagent-based autocomplete component would be incredibly useful

pesterhazy13:11:34

perhaps a prepackaged react based solution would actually be a better choice: http://react-autosuggest.js.org/

shem13:11:56

thanks, that looks pretty elaborate. i'll cook up something. i did it once with om but it doesn't translate so well to re-frame

pesterhazy13:11:49

if you end up using a prepackaged solution, consider packaging it for cljsjs

pesterhazy14:11:55

ha, it's already on cljsjs 🙂

shem14:11:08

that still expects a static list of suggestions. if i got the coeffects right, it would be a good fit to use them to update the suggestions list based on user input

shem14:11:02

if there are e.g. 200 000 possible values, i'd rather not preload them...

pesterhazy14:11:29

yeah no it should be dynamic for sure

pesterhazy14:11:53

see the github example

pesterhazy14:11:24

hmmm that doesn't seem to work properly (backspace is half-broken?)

akiroz15:11:01

you should check your sub's return value then

knaman17:11:56

i have a users model more specifically an atom vector [], that i load on initial request, and then perform crud operations on it, eg, conj for adding, remove for delete and update-in for edit item, Just like my function gets notified if subscribed to users atom on any change to the it, i would love to a function be called that has ajax calls on changes to that atom, so that impurity is docoupled from the app.

knaman17:11:26

is there any existing library/implementation for this kinf of thing

akiroz18:11:27

@knaman I guess you could add an interceptor that does the ajax injected to all the events that updates your atom

akiroz18:11:59

or just add a http fx to all your events

knaman18:11:43

@akiroz is there a way i can subscribe to a newly added object or something in future to a vector(eg users []) for new item add?

akiroz18:11:16

not that I'm aware of, but you could have an event that adds an item which triggers a http-fx

jorda0mega18:11:57

@akiroz i did

(js/console.info...)
on the value returned right before it is wrapped in the reaction atom and it looks like it is returning the right info

jorda0mega18:11:23

it is only when it is wrapped in the reaction atom that it becomes state: null

akiroz18:11:29

@jorda0mega Hmm... I think I've seen something like this before in this channel... are you using any interceptors?

jorda0mega18:11:57

none that I'm aware of

akiroz18:11:05

maybe try calling subscribe from a repl to see if it also returns an atom of null?

jorda0mega18:11:24

didn't think of that. let me try