From a2d7e6525d4dafb36bbbc8e3a7448f318b8bacab Mon Sep 17 00:00:00 2001
From: Karishma Chadha <kchadha@scratch.mit.edu>
Date: Wed, 4 Apr 2018 22:00:22 -0400
Subject: [PATCH] Recording names should start at 1, and let the vm create
 fresh names as needed.

---
 src/containers/record-modal.jsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/containers/record-modal.jsx b/src/containers/record-modal.jsx
index 2fae86069..63cad1061 100644
--- a/src/containers/record-modal.jsx
+++ b/src/containers/record-modal.jsx
@@ -77,8 +77,7 @@ class RecordModal extends React.Component {
                     format: '',
                     dataFormat: 'wav',
                     rate: this.state.sampleRate,
-                    sampleCount: clippedSamples.length,
-                    name: `recording ${this.props.vm.editingTarget.sprite.sounds.length}`
+                    sampleCount: clippedSamples.length
                 };
 
                 // Load the encoded .wav into the storage cache and get resulting
@@ -92,6 +91,9 @@ class RecordModal extends React.Component {
 
                 // update vmSound object with md5 property
                 vmSound.md5 = `${md5}.${vmSound.dataFormat}`;
+                // The VM will update the sound name to a fresh name
+                // if the following is already taken
+                vmSound.name = 'recording 1';
 
                 this.props.vm.addSound(vmSound).then(() => {
                     this.props.onClose();
-- 
GitLab