Skip to content

Commit f75edfe

Browse files
merrymanlinusha
authored andcommitted
🎨: prevent in place modification of component definitions
1 parent 48c1208 commit f75edfe

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lively.morphic/layout.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,9 +1431,14 @@ export class TilingLayout extends Layout {
14311431
const policies = this.config.resizePolicies;
14321432
if (!policies) return;
14331433

1434-
for (let m of containerSpec.submorphs) {
1435-
let match, fixedTotalExtent;
1436-
if (m.isPolicy) m = m.spec;
1434+
for (let i = 0; i < containerSpec.submorphs.length; i++) {
1435+
let match; let fixedTotalExtent; let m = containerSpec.submorphs[i];
1436+
if (m.isPolicy) {
1437+
m = containerSpec.submorphs[i] = m.copy();
1438+
m = m.spec;
1439+
} else {
1440+
m = containerSpec.submorphs[i] = { ...m };
1441+
}
14371442
if (match = policies.find(([name, policy]) => name === m.name)) {
14381443
const [_, policy] = match;
14391444
if (policy.width === 'fill') {

0 commit comments

Comments
 (0)