User Tools

Site Tools


ember-autotracking-object-arrays

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
ember-autotracking-object-arrays [2023/09/20 04:43]
sausage
ember-autotracking-object-arrays [2023/09/20 04:48]
sausage
Line 157: Line 157:
     }     }
   
- @action changeContent(){}+    ​@action changeContent(){}
 } }
  
Line 195: Line 195:
 ==== Spread operator ==== ==== Spread operator ====
  
-For the second way to deal with the problem, let'​s ​change ​try adding our new object to the array using the spread operator:+For the second way to deal with the problem, let's try adding our new object to the array using the spread operator:
  
 <code javascript>​ <code javascript>​
Line 208: Line 208:
  
 This works too. The spread operator is only a deep copy of the first layer, [https://​medium.com/​@kevinlai76/​the-spread-operator-deep-and-shallow-copies-d193ac9b58bf | not the nested data]. Which is not a deep copy at all in my book. But it is enough to trigger a change in Ember. But we'll come back to this point a little later. This works too. The spread operator is only a deep copy of the first layer, [https://​medium.com/​@kevinlai76/​the-spread-operator-deep-and-shallow-copies-d193ac9b58bf | not the nested data]. Which is not a deep copy at all in my book. But it is enough to trigger a change in Ember. But we'll come back to this point a little later.
- 
-(move this)However,​ Ember still does not see size changes to the array at all. 
- 
  
 ==== Ember'​s pushObject ==== ==== Ember'​s pushObject ====
  
-Let's move now to trying Ember'​s ''​pushObject''​ function which is attached to all javascript arrays:+Let's move to trying Ember'​s ''​pushObject''​ function which is attached to all javascript arrays:
  
 <code javascript>​ <code javascript>​
ember-autotracking-object-arrays.txt ยท Last modified: 2023/09/20 04:53 by sausage