These are chat archives for jdubray/sam

Mar 2018
Jean-Jacques Dubray
Mar 04 2018 02:19 UTC
@victornoel I don't know anything about ngrx/store. I don't have time right now to explore.
@pfurini I would not call Redux complex, it is rather naive, thinking that a pure functional approach without temporal logic constructs could be used to manage application state mutations
Jean-Jacques Dubray
Mar 04 2018 08:52 UTC
@pfurini wrt nap, render is a special next action. If you want to use the predicate correctly, you would return true if a (synchronous) next action was triggered, false otherwise. You would then render on false. The predicate can be used to decide whether we are ready to release the state to its consumer(s)
Mar 04 2018 12:32 UTC
@victornoel This might be interesting for you:
Paolo Furini
Mar 04 2018 12:41 UTC
@Nivani seems very interesting, thanks for sharing.. I haven't looked through the code yet, but every practical example of angular + SAM is always welcome 👍
Victor Noël
Mar 04 2018 12:53 UTC
@jdubray now I understand that when you said "ngrx pub/sub" at the beginning on the discussion, you actually meant "rxjs pub/sub"...
thx @Nivani
Jean-Jacques Dubray
Mar 04 2018 15:58 UTC
@victornoel sorry, too many libraries.
Jean-Jacques Dubray
Mar 04 2018 16:12 UTC
@Nivani the differences with my implementation are notable:
1/ Every Angular component has a present method to encapsulate mutations. Actions like this are prohibited, you can present to the local SAM instance or the parent/root :
public stopEditing(todo: Todo, editedTitle: string) {
    todo.title = editedTitle;
    todo.editing = false;
When your component is simple that does not make a bit difference, otherwise it does. It also allows you enter use the present method to process/present the parent state representation.
Jean-Jacques Dubray
Mar 04 2018 16:17 UTC
2/ Another big difference, services are innaccessible from any component (only actions and model)
constructor(private sam: NgSAM<Todos>, private todoService: TodoService) {
    todoService.getTodos().then(todos => this.presentTodos(todos));
public remove(todo: Todo) {
    this.todoService.removeTodo( => this.presentTodos(todos));
One could argue that all actions are in the app.component, but I would recommend keeping your application logic separate from your component logic .
devin ivy
Mar 04 2018 23:28 UTC
wow! this is a rather huge endorsement.
i don't just mean of immer, but of mutability in the context of state management. also, hearing the word "temporal"...