Closed dominics closed 3 months ago
If you make a get callFirestore with more than two where conditions, any additional where conditions are silently dropped. For example: this call will return projects where bar does not equal def:
get
callFirestore
bar
def
cy.callFirestore("get", "projects", { where: [ ["active", "==", true], ["foo", "==", "abc"], ["bar", "==", "def"], ], })
As another example showing that the where order matters, this call will return projects that aren't active:
cy.callFirestore("get", "projects", { where: [ ["name", ">=", "abc"], ["name", "<=", "abc\xff"], ["active", "==", true], ], })
Originally reported here: https://github.com/prescottprue/cypress-firebase/issues/501#issuecomment-1729915139
This happens because the where option handling only destructures two where conditions out of the array: https://github.com/prescottprue/cypress-firebase/blob/885abba7068fe4a392c47dcac828d8f93e53c17a/src/firebase-utils.ts#L276-L283
where
Opened this just to track the issue for the fix in PR: #1314
Great catch - thanks for making the issue and the PR to fix 👏
:tada: This issue has been resolved in version 4.1.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Bug Description
If you make a
get
callFirestore
with more than two where conditions, any additional where conditions are silently dropped. For example: this call will return projects wherebar
does not equaldef
:As another example showing that the where order matters, this call will return projects that aren't active:
Originally reported here: https://github.com/prescottprue/cypress-firebase/issues/501#issuecomment-1729915139
Why It Happens
This happens because the
where
option handling only destructures two where conditions out of the array: https://github.com/prescottprue/cypress-firebase/blob/885abba7068fe4a392c47dcac828d8f93e53c17a/src/firebase-utils.ts#L276-L283Solution
Opened this just to track the issue for the fix in PR: #1314