Skip to content

Commit 2df7b9d

Browse files
authored
Use visibility condition formula for formula generator (baserow#4286)
1 parent 455efc6 commit 2df7b9d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

backend/src/baserow/contrib/builder/elements/registries.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,24 @@ def get_pytest_params(self, pytest_data_fixture) -> Dict[str, Any]:
392392
create related objects when the import / export functionality is tested.
393393
"""
394394

395+
def formula_generator(
396+
self, element: Element
397+
) -> Generator[str | Instance, str, None]:
398+
"""
399+
Generator that returns formula fields for the LinkElementType.
400+
401+
Unlike other Element types, this one has its formula fields in the
402+
page_parameters and query_prameters JSON fields.
403+
"""
404+
405+
yield from super().formula_generator(element)
406+
407+
# Deal with visibility_condition
408+
new_formula = yield element.visibility_condition
409+
if new_formula is not None:
410+
element.visibility_condition = new_formula
411+
yield element
412+
395413

396414
ElementTypeSubClass = TypeVar("ElementTypeSubClass", bound=ElementType)
397415

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "bug",
3+
"message": "Fix visibility condition not working if data property wasn't used in page",
4+
"issue_origin": "github",
5+
"issue_number": null,
6+
"domain": "builder",
7+
"bullet_points": [],
8+
"created_at": "2025-11-18"
9+
}

0 commit comments

Comments
 (0)