Skip to content

[HOLD for payment 2024-10-11] Optimistic API READ updates are not applied immediately if write requests are queued #48053

Description

@hannojg

Slack thread

In this PR:

we introduced for read requests to happen only after any write request has completed. An example for that is this use case:

  • You are offline and create a workspace
  • then you come online
  • You created the workspace optimistically, but because you had some other write requests queued, your READ to get workspace list goes to the server before the WRITE to create the workspace
  • The READ to get workspace list uses an Onyx.set, and your optimistic workspace is not included, so it disappears
  • A few moments later, your request to create a workspace goes through, and it shows back up

however, due to that change we stopped applying optimistic READ updates immediately. Instead, now, the optimistic updates are only applied once all write requests has finished.

This can cause bugs. One bug for example is here, where we open a new component which fires a READ request on mount. It sets a loading state, and that one is expected to immediately become visible in the UI:

Screenshot 2024-08-26 at 20 32 03

But as the read requests optimistic update is delayed we just see a blank page:

Screenshot 2024-08-26 at 20 32 57

Screenshot 2024-08-27 at 08 41 49

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting PaymentAuto-added when associated PR is deployed to productionWeeklyKSv2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions