File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
app/assets/javascripts/components Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 21
21
@ debits () + @ credits ()
22
22
23
23
addRecord : (record ) ->
24
- records = @state .records .slice ()
25
- records .push record
24
+ records = React .addons .update (@state .records , { $push : [record] })
26
25
@ setState records : records
27
26
28
27
deleteRecord : (record ) ->
29
- records = @state .records .slice ()
30
- index = records .indexOf record
31
- records .splice index, 1
28
+ index = @state .records .indexOf record
29
+ records = React .addons .update (@state .records , { $splice : [[index, 1 ]] })
32
30
@ replaceState records : records
33
31
34
32
render : ->
Original file line number Diff line number Diff line change @@ -22,5 +22,7 @@ class Application < Rails::Application
22
22
23
23
# Do not swallow errors in after_commit/after_rollback callbacks.
24
24
config . active_record . raise_in_transactional_callbacks = true
25
+
26
+ config . react . addons = true
25
27
end
26
28
end
You can’t perform that action at this time.
0 commit comments