These are chat archives for jdubray/sam

19th
May 2016
weepy
@weepy
May 19 2016 10:21
I had a question about causing events in the view
Say I need to call a function in the view to kick off an animation to show a dialog
so typically I can just pass visiblePopup = true into the view and use a CSS animation
but what if I want to call a function ?
Jean-Jacques Dubray
@jdubray
May 19 2016 11:08
SAM is really about managing the application state. You have to decide how the animation relates to the application state (started/completed). - - Sometimes it has no implication. For instance, you may have an animation that brings up a login panel when you mouse over a "login" area. There is no need to to through SAM for that. Logically, the login panel was alway there (you are not in the state "logged in").
  • Sometimes, you just want to record that the animation has started but not render anything. SAM supports that as well.
weepy
@weepy
May 19 2016 11:09
i was wondering how to trigger functions in a view for example - because you have V(m)
Jean-Jacques Dubray
@jdubray
May 19 2016 11:10
The generated HTML can be anything you want, it does not have to point to a SAM action
You just have to make sure your function is accessible
weepy
@weepy
May 19 2016 11:11
yeah ok
of course this sits slightly outside V(m)
Jean-Jacques Dubray
@jdubray
May 19 2016 11:11
yes 100%
As I mentioned yesterday, even Redux tweaks the DOM... (input.value='')
<form onSubmit={e => {
        e.preventDefault()
        if (!input.value.trim()) {
          return
        }
        dispatch(addTodo(input.value))
        input.value = ''
      }}>
        <input ref={node => {
          input = node
        }} />
        <button type="submit">
          Add Todo
        </button>
      </form>
    </div>
SAM is just one way to implement event handlers, I would not claim it to be the only way.
Jean-Jacques Dubray
@jdubray
May 19 2016 11:16
When the changes to the DOM are truly isolated (not part of the application state), more like an intrinsic behavior of the component, there is no need to go through a SAM or Redux loop
weepy
@weepy
May 19 2016 11:17
m
weepy
@weepy
May 19 2016 11:28
thanks for the advice
Fred Daoud
@foxdonut
May 19 2016 12:11
I had the same interrogation and was thinking the same thing @jdubray , I am glad to hear some reinforcement from you.
Jean-Jacques Dubray
@jdubray
May 19 2016 16:59
It becomes hard to understand and debug an application when developers make the assumption that there is only one execution for each of the Observables coming from drivers. In reality, it’s a hidden source of problems that they need to be aware of.
Cycle.js creates "xstream" because Rx.js doesn't work for them.
Why didn't I think of that before?
devin ivy
@devinivy
May 19 2016 17:42
think of what?
Fred Daoud
@foxdonut
May 19 2016 17:43
how do you mean @jdubray ?
Jean-Jacques Dubray
@jdubray
May 19 2016 17:47
That Rx.js subscriptions are difficult to manage
RxJS Observables are generally cold. This means that two different calls to subscribe() will generate two separate side effect free executions of the Observable. Hot, on the other hand, is when different calls to subscribe() may share the same execution of the Observable.
How can you achieve consistency with Rx.js?