These are chat archives for jdubray/sam

Apr 2016
Jean-Jacques Dubray
Apr 02 2016 04:11 UTC
Really excited to announce that SAFE now supports "action hang back"
With action hang back SAFE ensures that, in any given step, when more than one action is triggered, only one gets to modify the model, all the others are ignored
In the code sample, one of the actions simulates a long running behavior: = (data,next) => {
    data.item = {title: data.title, description: data.description, id: || ''} ;
    if ( !== '') {
        // simulate a slow save after
        // editing an item
        setTimeout(function() { 
            actions.present(data,next) ;
        }, 9000);
    else {
        // proceed as normal when created a new item
        actions.present(data,next) ;
    return false ;
} ;
When you modify a blog entry and you hit save, the action will present its data 9s later. When you hit cancel before the save action presents its values to the model, then the save action will not be able to present its values