Skip to content

Commit

Permalink
Fix: Amended getModelContainer to work with blocks (adaptlearning#181)
Browse files Browse the repository at this point in the history
* Amended `getModelContainer` to work with blocks - fixes adaptlearning#180.

* Removed changes which shouldn't have been committed for adaptlearning#180.
  • Loading branch information
danielghost committed Dec 12, 2022
1 parent 2276aff commit 21590d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ export function getModelConfig(model) {
}

/**
* Returns the first model in the inheritance chain with _onChildren: true
* Returns the first model in the inheritance chain with `_onChildren: true`.
* If no model found, return the first inheritance model (should match the param model but inheritance checks the `_trickle` config).
* @param {Backbone.Model} model
* @returns {Backbone.Model}
*/
Expand All @@ -160,7 +161,7 @@ export function getModelContainer(model) {
const defaults = getModelConfigDefaults(inheritModel);
const config = $.extend(true, {}, defaults, inheritModel.get('_trickle'));
return config._onChildren;
});
}) ?? inheritance?.[0];
}

/**
Expand Down

0 comments on commit 21590d1

Please sign in to comment.