agritheory / beam

General Purpose 2D barcode scanning for ERPNext
https://agritheory.com/documentation/beam/
Other
23 stars 11 forks source link

[mobile] State-matching and queuing endpoint #105

Open agritheory opened 5 months ago

agritheory commented 5 months ago

One of the requirements for a low-friction mobile scanning interface is the ability to enqueue an action and update the app UI optimistically. When it succeeds, it can resolve this with the UI transparently. If there's a failure, it should notify and/or undo changes, depending on their context.

We would expect this to map to a GQL subscription so that the user knows errors. We will want to port this implementation into a yet-to-be-started python package. A Frappe app implementation exists here

This can be achieved by providing notification functions for the on_success and on_failure callbacks: https://github.com/frappe/frappe/blob/version-15/frappe/utils/background_jobs.py#L67-L68

These should both push data on subscription to the client