Repository navigation
perf(client): skip __includedeleted on initial offline pull into an empty table - #585
Merged
Merged
Conversation
…mpty table The pull operation always sent __includedeleted=true, even on an initial pull where no local records exist that a soft-deleted item could remove. On services with many soft-deleted records this made the first sync download a lot of unneeded data. __includedeleted=true is now only sent when a delta-token exists, or when the local table already holds entities of the pulled type (for example if the delta-token was cleared, or another query populated the table). Closes CommunityToolkit#576
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop requesting soft-deleted records (
__includedeleted=true) on the initial offline pull into an empty local table. Nothing exists locally for a deleted record to remove, so downloading them only slows the first sync when the service holds many soft-deleted rows.Changes
PullOperationManager.PrepareQueryDescriptionnow takes ahasLocalEntitiesargument.__includedeleted=trueis sent only when a delta-token exists (incremental pull) or the local table already contains entities of the pulled type.docs/in-depth/client/index.mddescribes the new behavior.No public API changes (
PrepareQueryDescriptionisinternal).Behavior notes
__includedeleted=true. The result is the same local data.$countandItemsTotalin synchronization events for such a pull now count only non-deleted items.Testing
OfflineDbContext_Tests.PullOperationManager_Testsfor: initial pull on an empty table, initial pull with local entities, delta pull with no local entities, removing a pre-setIncludeDeleted, andHasLocalEntitiesAsync.dotnet testrun passes, including the Docker-backed suites.build-libraryandbuild-docsworkflows pass on the fork.Closes #576