Skip to content

Commit

Permalink
Merge pull request #4036 from ProjectMirador/manifesto
Browse files Browse the repository at this point in the history
Don't let manifesto mutate the manifest json.
  • Loading branch information
cbeer authored Dec 13, 2024
2 parents 514d18a + 6591559 commit d105e6b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/state/selectors/manifests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { getConfig } from './config';
/** */
function createManifestoInstance(json, locale) {
if (!json) return undefined;
const manifestoObject = Utils.parseManifest(json, locale ? { locale } : undefined);
// Use JSON stringify/parse to create a deep copy and prevent Manifesto from mutating the json
const manifestoObject = Utils.parseManifest(JSON.parse(JSON.stringify(json)), locale ? { locale } : undefined);
// Local patching of Manifesto so that when its a Collection, it behaves similarly
if (typeof manifestoObject.getSequences != 'function') {
manifestoObject.getSequences = () => [];
Expand Down

0 comments on commit d105e6b

Please sign in to comment.