4

Trying to understand conceptually how Optimistic UI works, appreciate any help!

Scenario:

  • We send a mutation to create a new User "John" --> Request A
  • We leverage the Optimistic UI feature to immediately return 'fake' data for "John"
    • Fake "John" has the Id field: "FakeId10001"
  • Before we get a response from Request A, we send another mutation to update "John"'s name to "Johnny" --> Request B
  • Request A finally gets processed, and creates a User "John" with Id "10001"
  • The server now tries to process Request B

Presumably, Request B would try to update the User with Id "FakeId10001" and fail, since that user does not exist.

Does Apollo wait for Request A to respond before sending Request B, or anything else to handle this behaviour?

Ray J
  • 805
  • 1
  • 9
  • 13

0 Answers0