Skip to content

Commit

Permalink
Restore dual require for Citations collection; add dual require for C…
Browse files Browse the repository at this point in the history
…itation Model

Restore dual require for Citations collection; add dual require for Citation Model

#2395
  • Loading branch information
rushirajnenuji committed May 2, 2024
1 parent 28f6859 commit e2e9b7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/collections/Citations.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global define */
"use strict";

define(['jquery', 'underscore', 'backbone'],
function($, _, Backbone) {
define(['jquery', 'underscore', 'backbone', 'models/CitationModel'],
function($, _, Backbone, CitationModel) {

/**
* @class Citations
Expand All @@ -18,7 +18,7 @@ define(['jquery', 'underscore', 'backbone'],
/** @lends Citations.prototype */{

model: function (attrs, options) {
// We use the inline require here to
// We use the inline require here in addition to the define above to
// avoid an issue caused by the circular dependency between
// CitationModel and Citations
var CitationModel = require('models/CitationModel');
Expand Down
5 changes: 5 additions & 0 deletions src/js/models/CitationModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ define(["jquery", "underscore", "backbone", "collections/Citations"], function (
// Format the citation metadata = DataONE datasets cited by this
// citation (external document)
const cm = response.citationMetadata;

// We use the inline require here in addition to the define above to
// avoid an issue caused by the circular dependency between
// CitationModel and Citations
var Citations = require('collections/Citations');
if (cm) {
if (cm && !(cm instanceof Citations)) {
const citationMetadata = Object.entries(cm).map(([pid, data]) => {
Expand Down

0 comments on commit e2e9b7c

Please sign in to comment.