Skip to content

Commit 52a5188

Browse files
authored
fix: resolve a path import bug in row-change triggers. (baserow#5018)
1 parent 61a34cb commit 52a5188

3 files changed

Lines changed: 51 additions & 6 deletions

File tree

backend/src/baserow/contrib/integrations/local_baserow/service_types.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,11 +2373,13 @@ def import_path(self, path, id_mapping):
23732373
Import Local Baserow signal service types paths.
23742374
"""
23752375

2376-
# All Local Baserow signal service types have a length of 3:
2377-
# {previousNodeId}.{rowIndex}.{fieldName}. By this point, we should
2378-
# only have two parts: {rowIndex}.{fieldName}.
2379-
if len(path) == 2:
2380-
index, field_dbname = path
2376+
# If we receive:
2377+
# {previousNodeId}.{rowIndex}.{fieldName}, or
2378+
# {previousNodeId}.{rowIndex}.{fieldName}.{fieldValueIndex}.{value}
2379+
# (e.g. a `link_row`)
2380+
# then pluck out the row index / field name and use it.
2381+
if len(path) >= 2:
2382+
index, field_dbname, *rest = path
23812383
else:
23822384
# In any other scenario, we have a formula that is not a format we
23832385
# can currently import properly, so we return the path as is.
@@ -2392,7 +2394,7 @@ def import_path(self, path, id_mapping):
23922394
self.import_property_name(field_dbname, id_mapping) or field_dbname
23932395
)
23942396

2395-
return [index, imported_field_dbname]
2397+
return [index, imported_field_dbname, *rest]
23962398

23972399

23982400
class LocalBaserowRowsCreatedServiceType(LocalBaserowRowsSignalServiceType):
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pytest
2+
3+
from baserow.contrib.integrations.local_baserow.service_types import (
4+
LocalBaserowRowsCreatedServiceType,
5+
)
6+
7+
8+
@pytest.mark.parametrize(
9+
"path,id_mapping,expected",
10+
[
11+
# When path has fewer than 2 elements, return as is
12+
([], {}, []),
13+
(["0"], {}, ["0"]),
14+
# When field_dbname doesn't start with "field_", return path as is
15+
(["0", "id"], {}, ["0", "id"]),
16+
(["0", "foo"], {}, ["0", "foo"]),
17+
# {rowIndex}.{fieldName} and field not in mapping
18+
(["0", "field_1"], {}, ["0", "field_1"]),
19+
# {rowIndex}.{fieldName} and field in mapping
20+
(["0", "field_1"], {"database_fields": {1: 2}}, ["0", "field_2"]),
21+
# {rowIndex}.{fieldName}.{fieldValueIndex}.{value} and field not in mapping
22+
(["0", "field_1", "0", "value"], {}, ["0", "field_1", "0", "value"]),
23+
# {rowIndex}.{fieldName}.{fieldValueIndex}.{value} and field in mapping
24+
(
25+
["0", "field_1", "0", "value"],
26+
{"database_fields": {1: 2}},
27+
["0", "field_2", "0", "value"],
28+
),
29+
],
30+
)
31+
def test_local_baserow_rows_signal_service_type_import_path(path, id_mapping, expected):
32+
assert (
33+
LocalBaserowRowsCreatedServiceType().import_path(path, id_mapping) == expected
34+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "bug",
3+
"message": "Resolved a bug which prevented certain Baserow field types from being used after a row-change trigger.",
4+
"issue_origin": "github",
5+
"issue_number": null,
6+
"domain": "automation",
7+
"bullet_points": [],
8+
"created_at": "2026-03-20"
9+
}

0 commit comments

Comments
 (0)