fix(db-mongodb): destructuring error when trying to filter date fields by string query (#9116)

Previously, when filtering the internal link relationship in lexical by
typing in the relationship field, it would throw an error, as that
relationship field has a relation to "date-fields".
This commit is contained in:
Alessio Gravili
2024-11-11 20:41:02 -07:00
committed by GitHub
parent 7261faac57
commit 6899a3cc27

View File

@@ -89,11 +89,7 @@ export async function buildSearchParam({
const [{ field, path }] = paths const [{ field, path }] = paths
if (path) { if (path) {
const { const sanitizedQueryValue = sanitizeQueryValue({
operator: formattedOperator,
rawQuery,
val: formattedValue,
} = sanitizeQueryValue({
field, field,
hasCustomID, hasCustomID,
operator, operator,
@@ -101,6 +97,12 @@ export async function buildSearchParam({
val, val,
}) })
if (!sanitizedQueryValue) {
return undefined
}
const { operator: formattedOperator, rawQuery, val: formattedValue } = sanitizedQueryValue
if (rawQuery) { if (rawQuery) {
return { value: rawQuery } return { value: rawQuery }
} }