-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1206 from concord-consortium/185588012-optimize-c…
…ollections-listing feat: Optimize collections listing [PT-185588012]
- Loading branch information
Showing
11 changed files
with
112 additions
and
54 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,3 +151,9 @@ | |
overflow:hidden; | ||
} | ||
} | ||
|
||
.htmlContentEditor { | ||
width: 100%; | ||
height: 300px; | ||
font-family: monospace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
react-components/src/library/helpers/materials-collection-cache.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const cache = {} | ||
|
||
export const loadMaterialsCollections = (ids, callback) => { | ||
const onComplete = () => { | ||
const data = ids.map(id => cache[id] || { name: 'MISSING-COLLECTION-' + id, materials: [] }) | ||
callback(data) | ||
} | ||
|
||
// ensure we only request each id once | ||
const missingIds = ids.filter(id => !cache[id]) | ||
if (missingIds.length === 0) { | ||
onComplete() | ||
return | ||
} | ||
|
||
jQuery.ajax({ | ||
url: Portal.API_V1.MATERIALS_BIN_COLLECTIONS, | ||
data: { | ||
id: missingIds, | ||
skip_lightbox_reloads: true | ||
}, | ||
dataType: 'json', | ||
success: (missingData) => { | ||
missingIds.forEach((id, index) => { | ||
cache[id] = missingData[index] | ||
}) | ||
}, | ||
complete: () => { | ||
onComplete() | ||
} | ||
}) | ||
} | ||
|
||
export const loadMaterialsCollection = (id, callback) => { | ||
loadMaterialsCollections([id], (data) => { | ||
callback(data[0]) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters