Skip to content

Commit

Permalink
added option for not instantiating GridData on dataservice.getGrid (p…
Browse files Browse the repository at this point in the history
…erformance), #451
  • Loading branch information
klues committed Nov 20, 2024
1 parent 4fe96ad commit 880ecef
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/js/service/data/dataService.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ let dataService = {};
*
* @param id the ID of the grid
* @param onlyShortVersion if true only the short version (with stripped binary data) is returned (optional)
* @param noObjectModel if true, result is not converted to object model instance (performance)
* @return {Promise} resolves to a grid object that was found
*/
dataService.getGrid = async function (id, onlyShortVersion) {
dataService.getGrid = async function (id, onlyShortVersion, noObjectModel) {
if (!id) {
return Promise.resolve(null);
}
return databaseService.getSingleObject(GridData, id, onlyShortVersion).then((result) => {
return Promise.resolve(result ? new GridData(result) : null);
if (!noObjectModel) {
result = result ? new GridData(result) : null;
} else {
result = result ? gridUtil.ensureDefaults(result) : null;
}
return Promise.resolve(result);
});
};

Expand Down

0 comments on commit 880ecef

Please sign in to comment.