aurelia / aurelia/templating

@bindable should support getter/setter

Open
#579 14 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
113
Forks
101
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a feature request**

**Current behavior:**
The @bindable decorator overrides virtual getters/setters

**Expected/desired behavior:**
The @bindable decorator should respect virtual getters/setters (i.e. it should wrap any already existing getter/setter with its own getter or setter).

Using getters/setters makes for some really beautiful code in Aurelia. When combining them with the @computedFrom decorator as well as some custom decorators that I have:

- @connected (for a property that is connected to a redux store)
- @awaitedBindable (for an asynchronous value)

I end up writing almost no proper functions. Instead my viewModels end up looking like the glue that the y are supposed to be, just a bunch of getters/setters.

The one big problem that I am encountering is the @bindable decorator. Because I can't define virtual getters and setters, I am forced to use the propertyChanged convention. This ends up uglier, more confusing and I end up running into a bunch of infinite loops.

Contributor guide

Open the contributing guide

Research direction

Start by locating the @bindable decorator implementation and how it handles existing virtual getters and setters. Reproduce the issue with a bindable property that already defines accessors, then verify that the decorator preserves and wraps them without causing the infinite loops described in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.