1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-04 21:25:24 +00:00

Resolve "Updating a cell fails when a view is sorted or grouped by a linked field that has a primary field of the type formula"

This commit is contained in:
Davide Silvestri 2025-03-11 14:31:05 +01:00
parent 85ec619869
commit b31430f44c
2 changed files with 25 additions and 2 deletions
changelog/entries/unreleased/bug
web-frontend/modules/database/formula

View file

@ -0,0 +1,8 @@
{
"type": "bug",
"message": "Updating a cell no longer fails when a view is sorted or grouped by a linked field whose primary field is a formula.",
"domain": "database",
"issue_number": 3484,
"bullet_points": [],
"created_at": "2025-03-10"
}

View file

@ -261,6 +261,14 @@ export class BaserowFormulaTypeDefinition extends Registerable {
toBaserowFormulaType(field) {
return this.getType()
}
parseFromLinkedRowItemValue(field, value) {
const underlyingFieldType = this.app.$registry.get(
'field',
this._mapFormulaTypeToFieldType(field.formula_type)
)
return underlyingFieldType.parseFromLinkedRowItemValue(field, value)
}
}
export class BaserowFormulaTextType extends mix(
@ -753,8 +761,10 @@ export class BaserowFormulaArrayType extends mix(
const innerSortFunction = subType.getSort(name, order, field)
return (a, b) => {
const valuesA = a[name].map(subType.mapToSortableArray.bind(subType))
const valuesB = b[name].map(subType.mapToSortableArray.bind(subType))
const valA = Array.isArray(a[name]) ? a[name] : [a[name]]
const valB = Array.isArray(b[name]) ? b[name] : [b[name]]
const valuesA = valA.map(subType.mapToSortableArray.bind(subType))
const valuesB = valB.map(subType.mapToSortableArray.bind(subType))
for (let i = 0; i < Math.max(valuesA.length, valuesB.length); i++) {
let compared = 0
@ -825,6 +835,11 @@ export class BaserowFormulaArrayType extends mix(
toBaserowFormulaType(field) {
return this.getSubType(field)?.toBaserowFormulaType(field)
}
parseFromLinkedRowItemValue(field, value) {
const subType = this.getSubType(field)
return subType.parseFromLinkedRowItemValue(field, value)
}
}
export class BaserowFormulaFileType extends BaserowFormulaTypeDefinition {