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

Pre-RFC: Multiplex Requests #8855

Open
runspired opened this issue Sep 10, 2023 · 0 comments
Open

Pre-RFC: Multiplex Requests #8855

runspired opened this issue Sep 10, 2023 · 0 comments

Comments

@runspired
Copy link
Contributor

Currently, requests triggered around the same time (for instance by multiple components or routes) will resolve as soon as their data is received and process.

This can lead to a lot of extraneous churn in application state.

Sometimes applications can multiplex promises themselves using RSVP.hash or RSVP.all; however, this is not always the case. A smarter router could also multiplex across routes. This feature would bridge the gap for applications for which a smarter router is not available.

We should consider adding a mechanism to request specific to multiplexing. Multiplexed requests would exhibit two key behaviors differing from non-multiplexed requests.

  1. Their promises would not resolve until they all can resolve, meaning that they resolve within a single microtask queue.

  2. The updates they push to the cache would not notify the UI of any changes until all multiplexed requests have completed.

Roughly the API would look like this

store.request({
  url: 'my-url',
  cacheOptions: {
    multiplex: true
  }
});

Once a multiplexed request begins, no requests may resolve until it resolves. This means that requests that the longest request specifying multiplexing is the one which determines when request resolution occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Planning
Development

No branches or pull requests

1 participant