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: deprecate non-request-manager request methods on the store #8873

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

pre-rfc: deprecate non-request-manager request methods on the store #8873

runspired opened this issue Sep 17, 2023 · 0 comments

Comments

@runspired
Copy link
Contributor

runspired commented Sep 17, 2023

The RequestManager paradigm is simply that any request starts by providing FetchOptions. These may be built programmatically (for instance for relationships or collections that return links information from the API), or by builders or even manually

The paradigm has the simple goal of "use the platform". Importantly, it is this usage that allows us to intelligently cache requests and documents alongside resources, opening up vast possibilities for helpful new features for EmberData.

In this paradigm, all requests for the store should begin by calling store.request. Today though that is not the case.

Currently, the Store allows users to continue using the historical methods for fetching or mutating data.

Group 1

  • store.findRecord
  • store.findAll
  • store.query
  • store.queryRecord
  • store.saveRecord
  • model.save
  • model.reload
  • model.destroyRecord

These historical methods include the hasMany and belongsTo behaviors on @ember-data/model

Group 2

  • accessing an async belongsTo
  • accessing an async hasMany

As well as corresponding relationship reference fetching methods

Group 3

  • HasManyReference.load()
  • HasManyReference.reload()
  • BelongsToReference.load()
  • BelongsToReference.reload()

These historical request methods currently translate their arguments into the shape expected by RequestManager with a few major caveats:

  • they require using the LegacyCompatHandler and adapter/serializer logic or something mimicking it
  • they are not as flexible at the callsite
  • they are not cacheable since they do not set cacheKey and do not provide a url

Now that builders have shipped in 5.3, we would like to RFC deprecating all of group 1 to begin simplifying the mental model of how EmberData should be used.

Groups 2 and 3 should not be deprecated until we've either provided an alternative decorator to replace async belongsTo and hasMany or shipped SchemaRecord

From a deprecation perspective this RFC is similar to [https://github.com/emberjs/rfcs/pull/745]. The primary impact will be that anyone using these methods needs to refactor to store.request. The biggest lift here will most certainly be around the learning story, as many places in the API docs, the guides and the tutorial show the older form.

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

No branches or pull requests

1 participant