Skip to content

Instantly share code, notes, and snippets.

@geovanisouza92
Created July 10, 2016 16:37
Show Gist options
  • Select an option

  • Save geovanisouza92/52160fdf93a77b93b8e63e6e364d5d4a to your computer and use it in GitHub Desktop.

Select an option

Save geovanisouza92/52160fdf93a77b93b8e63e6e364d5d4a to your computer and use it in GitHub Desktop.
Problems with "xexpr"

Demo

http://www.webpackbin.com/VkQt0UiUb

Problem 1

The first result ever is not emitted

How to reproduce:

  • Add an item a with formula 1
  • Change the a formula to 10

Expected:

```
formula for (a) changed to 1
scope {}
evaluating (a) with scope {}
inner result {"name":"a","formula":"1","value":1}
outer result {"name":"a","formula":"1","value":1}
proxy result {"name":"a","formula":"1","value":1}
scope {"a":1}
```

Actual:

```
formula for (a) changed to 1
scope {}
evaluating (a) with scope {}
inner result {"name":"a","formula":"1","value":1}
```

When the formula is changed, it emits the expected behavior:

```
formula for (a) changed to 1
scope {}
evaluating (a) with scope {}
inner result {"name":"a","formula":"1","value":1}
formula for (a) changed to 10
evaluating (a) with scope {}
inner result {"name":"a","formula":"10","value":10}
outer result {"name":"a","formula":"10","value":10}
proxy result {"name":"a","formula":"10","value":10}
scope {"a":10}
```

Problem 2

Emitting duplicated values, even with dropRepeats()

How to reproduce:

  • Add an item a with formula 1
  • Change the a formula to 10 (to bypass the previous problem)
  • Add an item b with formula a
  • Change the a formula to 11

Expected: To not bubble repeated values

Actual:

```
formula for ( a ) changed to Object {text: "1", vars: Array[0], expr: Object, ok: true}
scope Object {}
evaluating ( a ) with scope Object {}
inner result Object {name: "a", formula: "1", value: 1}
formula for ( a ) changed to Object {text: "10", vars: Array[0], expr: Object, ok: true}
evaluating ( a ) with scope Object {}
inner result Object {name: "a", formula: "10", value: 10}
outer result Object {name: "a", formula: "10", value: 10}
proxy result Object {name: "a", formula: "10", value: 10}
scope Object {a: 10}
formula for ( b ) changed to Object {text: "a", vars: Array[1], expr: Object, ok: true}
evaluating ( b ) with scope Object {a: 10}
inner result Object {name: "b", formula: "a", value: 10}
outer result Object {name: "b", formula: "a", value: 10}
proxy result Object {name: "b", formula: "a", value: 10}
scope Object {a: 10, b: 10}
formula for ( a ) changed to Object {text: "11", vars: Array[0], expr: Object, ok: true}
evaluating ( a ) with scope Object {}
inner result Object {name: "a", formula: "11", value: 11}
outer result Object {name: "a", formula: "11", value: 11}
proxy result Object {name: "a", formula: "11", value: 11}
scope Object {a: 11, b: 10}
evaluating ( b ) with scope Object {a: 11}
inner result Object {name: "b", formula: "a", value: 11}
outer result Object {name: "b", formula: "a", value: 11}
proxy result Object {name: "b", formula: "a", value: 11}
scope Object {a: 11, b: 11}
evaluating ( b ) with scope Object {a: 11}
inner result Object {name: "b", formula: "a", value: 11}
outer result Object {name: "b", formula: "a", value: 11}
proxy result Object {name: "b", formula: "a", value: 11}
scope Object {a: 11, b: 11}
............................................... (repeat last 5 lines)
evaluating ( b ) with scope Object {}
inner result Object {}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment