Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With this one, the database is an immutable value, so you can hold on to old versions of it. Here's an incomplete example of how you could implement optimistic updates:

    tx_report = datascript.transact(db_conn, [{:key "value"}]);
    set_db_to_render_from(tx_report.db_after);
    send_report_to_server(tx_report, function(error) {
      set_db_to_render_from(tx.report.db_before);
    });


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: