Skip to content

Commit f6efd50

Browse files
committed
set options.parse to false if we are set()ing actual bb models
1 parent cf2af96 commit f6efd50

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

backbone.JJRelational.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ do () ->
520520
changes.push key
521521
@.changed[key] = value
522522
value = if _.isArray value then value else [value]
523-
# if we already have a collection, don't empty it - just simply call set() on it!
523+
# if we already have a collection, don't empty it - just simply call `set()` on it!
524524
if currValue instanceof Backbone.Collection
525525
currValue.set value, options
526526
else
@@ -1065,6 +1065,9 @@ do () ->
10651065
# set options.merge to false as we have alread merged it with the call to `_prepareModel` above (when working with store)
10661066
if Backbone.JJRelational.Config.work_with_store then options.merge = false
10671067

1068+
# set parse to false if we've got actual backbone models in the collection, otherwise we'd be re-parsing them
1069+
options.parse = _.filter(modelsToAdd, (m) -> m instanceof Backbone.Model).length == 0
1070+
10681071
# Normal "`add`" and return collection for chainability
10691072
@.__set modelsToAdd, options
10701073

backbone.JJRelational.js

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backbone.JJRelational.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)