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

feat: paginated relationships #9320

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Apr 5, 2024

Once complete, this removes what is probably the largest blocker to us quickly shipping @warp-drive/schema-record and/or building decorators for @ember-data/model to replace belongsTo and hasMany with new semantics.

There are two paths forward with this PR:

  1. Replace the storage for all collection relationships with the paginated version
  2. Add isPaginated somewhere in the schema (either via kind or via something on options)
    and switch handling in the graph based on schema.

There's a case to be made for either, though I have a preference for the first as it likely offers the largest amount of test coverage by default and a single set of codepaths is simpler to maintain in the long run.

However, for the unpaginated case, performance may be slightly better in the old storage mechanism. I suspect though this will be easily offset by a couple of perf gains I noticed while implementing the storage for pagination in this PR: (1) we no longer need a separate array for remoteState and (2) construction of localState is ~15% faster if we use copy the set, delete the removals, and the Array.from the result.

The best case for (2) is that it may make handling the migration easier for legacy relationships, as editing those relationships generally uses patterns we want to discourage in new relationship primitives.

@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ feat This PR introduces a new feature labels Apr 5, 2024
@runspired runspired self-assigned this Apr 5, 2024
@runspired runspired linked an issue Apr 5, 2024 that may be closed by this pull request
@runspired runspired marked this pull request as draft April 6, 2024 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 canary PR is targeting canary (default) 🏷️ feat This PR introduces a new feature
Projects
Status: needs triage
Development

Successfully merging this pull request may close these issues.

pre-rfc: Support Paginated Relationships
1 participant