flow-playground icon indicating copy to clipboard operation
flow-playground copied to clipboard

Debounce GraphQL Mutations

Open neil-ptr opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. The playground starts to degrade in performance after typing out a good number of lines of code on an account, transaction or script that has been deployed. This is due to the constant updating upon every character being typed

Just typing this snippet of code out results in all the listed requests to the server Screen Shot 2022-08-03 at 11 41 53 AM Screen Shot 2022-08-03 at 11 42 14 AM As a result of the constant requests the following error is returned from the backend

bundle.esm.js:63 Uncaught (in promise) Error: GraphQL error: failed to update transaction template: rpc error: code = Aborted desc = Aborted due to cross-transaction contention. This occurs when multiple transactions attempt to access the same data, requiring Firestore to abort at least one in order to enforce serializability.
    at new t (bundle.esm.js:63:28)
    at Object.next (bundle.esm.js:1004:53)
    at C (Observable.js:135:18)
    at y (Observable.js:179:3)
    at e.value (Observable.js:235:7)
    at bundle.esm.js:866:75
    at Set.forEach (<anonymous>)
    at Object.next (bundle.esm.js:866:27)
    at C (Observable.js:135:18)
    at y (Observable.js:179:3)
    at e.value (Observable.js:235:7)
    at bundle.esm.js:76:26

Describe the solution you'd like Debounce the GraphQL mutations that update accounts, transactions and script draft code like UpdateAccountDraftCode mutation

Additional Notes Will put less stress on the backend as there will be less requests being sent

neil-ptr avatar Aug 03 '22 17:08 neil-ptr