Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Improve general error handling paths #34

Closed
awkay opened this issue Sep 13, 2017 · 5 comments
Closed

FEATURE: Improve general error handling paths #34

awkay opened this issue Sep 13, 2017 · 5 comments
Assignees
Milestone

Comments

@awkay
Copy link
Member

awkay commented Sep 13, 2017

After some discussion in #28 it became apparent that there are a couple of tweaks that would allow us to handle general errors in much more useful and advanced ways. See the comment stream in that issue for background, and add comments here to extend that conversation.

@petterik
Copy link
Contributor

Follow up. Your comments are quoted.

I also wonder about the limits of optimistic update on lag.

This is a scary thought indeed. But it hasn't been a problem for us yet.

Fulcro augmented Om Next by ensuring that tempids that appear in the network queue get rewritten on tempid remappings...so you can actually queue a create and update in sequence and have them work in complete optimistic mode.

Same here. We also update our mutations that are queued to get the correct id.

In the talk, the assumption is that your mutations might return something different from what you'd done optimistically. I think this is wrong.

We usually implement optimistic updates where we can fake what the correct result should be. E.g sending a chat message, it should show up in the chat. But I can recall times where we've done an optimistic mutation showing the user a "pending" result, that differs from the server's response and is replaced by it. There are other ways of implementing such behaviour though.

Regarding linear history. Our first attempt was to have a single history with no branches, but it got too hard for us when trying to do optimistic updates that had to be retracted or merged such that nothing changes when the response from the server matches the current state. You may have better ideas on how to implement it, but I found it very hard both to think about and to implement compared to the git-rebase version.

For some context, our first project was a budget web app where it was really nice to have optimistic updates. Now, we've released an e-commerce marketplace with live streaming (http://sulo.live) and it doesn't need as many optimistic updates. It's nice to have some times, like for the chat.

I agree with how you think mutation errors should be handled. I.e. auto-loop with back-off and rewind. We've got the auto-loop but not the rewind, but it sounds like a good idea!

@awkay
Copy link
Member Author

awkay commented Sep 15, 2017

The chat example is an interesting case. That is a case where you are direct-collaborating in a distributed system, but the problem there is "time" and "relativity". I think I'd implement that one without optimistic updates at all (you typing a message sends it to the server, and websocket pushes are always how things end up in your chat window). That way the server resolves "who spoke when". I guess you could do optimistic and use the server's timestamp with the "rebase" idea, and that is an example where that model is needed if you want to do it optimistically (though so is agreement on time).

I guess if you take the collaborative editing example of any kind (where optimistic updates are desired) then you have a much harder problem, and one that potentially makes kind of a mess. If we were both in offline-mode while editing the same line of text our interspersed edits would just as likely end up gibberish as anything useful.

@awkay awkay added this to the 2.0.0 milestone Oct 27, 2017
@awkay
Copy link
Member Author

awkay commented Oct 27, 2017

The new work on Fulcro 2.0 will improve dynamic queries and history to make this scheme possible. Hoping to have it done by the end of November, if not sooner.

@awkay awkay self-assigned this Nov 2, 2017
@awkay
Copy link
Member Author

awkay commented Nov 22, 2017

So, we've got dynamic queries, the history is improved, and I've just added ptransact!. The latter allows for manual sequential full-stack interactions that make error handling straightfoward for old-school interactions.

The automated stuff I'm aiming for with this ticket is going to be pretty interesting to implement. The fully-working history means that we can safely rewind UI to the point in history at which our last network interaction occurred. This means we can auto-retry on errors while the user is allowed to continue to work (possibly showing a "saving..." indicator in the UI somewhere. If the network stays gone too long, then we can rewind to the last-known-good spot, show them a dialog, and let them choose "retry some more, or restart from here"

@awkay
Copy link
Member Author

awkay commented Nov 22, 2017

This last bit is really issue #49

@awkay awkay closed this as completed Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants