fix(drizzle, ui): properly filters out number field values with the exists operator filter (#8706)
Filtering by `null` `number` field values or normal values with the `exists` operator was not working in `postgres` & `sqlite`. Was previously fixed for `mongodb` [here](https://github.com/payloadcms/payload/pull/8416) Now fixed for `postgres` & `sqlite` adapters as well.
This commit is contained in:
@@ -223,8 +223,11 @@ export const sanitizeQueryValue = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operator === 'exists') {
|
if (operator === 'exists') {
|
||||||
formattedValue = formattedValue === 'true' || formattedValue === true
|
formattedValue = val === 'true' || val === true
|
||||||
if (formattedValue === false) {
|
|
||||||
|
if (formattedValue) {
|
||||||
|
operator = 'exists'
|
||||||
|
} else {
|
||||||
operator = 'isNull'
|
operator = 'isNull'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,13 +133,13 @@ export const DefaultCell: React.FC<CellComponentProps> = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<WrapElement {...wrapElementProps}>
|
<WrapElement {...wrapElementProps}>
|
||||||
{(cellData === '' || typeof cellData === 'undefined') &&
|
{(cellData === '' || typeof cellData === 'undefined' || cellData === null) &&
|
||||||
i18n.t('general:noLabel', {
|
i18n.t('general:noLabel', {
|
||||||
label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),
|
label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),
|
||||||
})}
|
})}
|
||||||
{typeof cellData === 'string' && cellData}
|
{typeof cellData === 'string' && cellData}
|
||||||
{typeof cellData === 'number' && cellData}
|
{typeof cellData === 'number' && cellData}
|
||||||
{typeof cellData === 'object' && JSON.stringify(cellData)}
|
{typeof cellData === 'object' && cellData !== null && JSON.stringify(cellData)}
|
||||||
</WrapElement>
|
</WrapElement>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user