fix(@aws-amplify/datastore): Fix beginsWith() negation #10962
Merged
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.
Description of changes
Fixes an issue where the absence of special handling for the negation of
beginsWith
resulted in an error for queries like this:This fix would be a reasonable amount more difficult to figure out and grok using the existing storage predicate builder that V5 predicates was still using in some places. So, this PR pulls forward a refactor from #10949 around storage predication generation to make the fix sane and simple.
A component of that refactor is a fix to IndexedDBAdapter's determination of whether a predicate is a "key value predicate". I'm not sure clear on where the storage predicate builder handles
null
conditions, but IndexedDB throws a fit if you try toindex.get([null])
. For this refactor, I've opted explicitly handle this on the IndexedDBAdapter side, because issue only seems to affect IndexedDB.Issue #, if available
#10957
Description of how you validated changes
beginsWith
negation test fail.Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.