From f9f42454665fbba071b50589bdae9279b04ef28c Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Sat, 15 Jan 2022 14:42:02 -0500 Subject: [PATCH] (core) Fix adding multiple fields when editing card layout Summary: Bug reported by user (https://gristlabs.getgrist.com/k1f3bMzUvitZ/User-Feedback#a1.s3.r408.c8) Also make the test of editing RecordLayout work better (it was failing on Mac even on master) Test Plan: Added a test case for adding multiple fields Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3219 --- app/client/components/RecordLayout.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/client/components/RecordLayout.js b/app/client/components/RecordLayout.js index 178e62da..49a03581 100644 --- a/app/client/components/RecordLayout.js +++ b/app/client/components/RecordLayout.js @@ -254,7 +254,9 @@ RecordLayout.prototype.saveLayoutSpec = async function(layoutSpec) { // with items which require new columns first. let callbacks = addedCallbacks.concat(hiddenCallbacks); let positions = addedPositions.concat(hiddenPositions); - let addActions = gutil.arrayRepeat(addColNum, addColAction); + + // Use separate copies of addColAction, since sendTableActions modified each in-place. + let addActions = gutil.arrayRepeat(addColNum, 0).map(() => addColAction.slice()); await docData.bundleActions('Updating record layout.', () => { return Promise.try(() => {