Fix bug that causes editing a sample to discard unsaved work

This commit is contained in:
Kevin Thomas
2022-09-11 21:17:45 -07:00
parent e6cc5b36c5
commit 26fc54054f
4 changed files with 17 additions and 5 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "noisedash", "name": "noisedash",
"version": "0.6.3", "version": "0.6.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "noisedash", "name": "noisedash",
"version": "0.6.3", "version": "0.6.4",
"private": true, "private": true,
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)", "author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
"scripts": { "scripts": {

View File

@@ -297,7 +297,7 @@
<v-card-text> <v-card-text>
<v-container> <v-container>
<v-row> <v-row>
<p>Select profile to record audio for. This is only supported on Chrome and Firefox.</p> <p>Select profile to record audio for. This is only supported on Chrome and Firefox. Current profile will be saved before recording.</p>
</v-row> </v-row>
<v-row> <v-row>
<v-select <v-select
@@ -1026,7 +1026,7 @@
<v-text-field <v-text-field
v-model="previewSampleFadeIn" v-model="previewSampleFadeIn"
type="number" type="number"
label="Fade In Time" label="Fade In Time (In continuous mode, this only effects first playback)"
:disabled="previewSamplePlaying" :disabled="previewSamplePlaying"
:rules="[rules.gt(-1)]" :rules="[rules.gt(-1)]"
@change="updatePreviewSamplePlayerFadeIn" @change="updatePreviewSamplePlayerFadeIn"

View File

@@ -736,7 +736,16 @@ export default {
}).then(response => { }).then(response => {
if (response.status === 200) { if (response.status === 200) {
this.getSamples() this.getSamples()
this.loadProfile(false)
// Update sample if it's already loaded in current profile
const sample = this.loadedSamples.find(s => s.id === this.selectedPreviewSample.id)
if (sample) {
sample.fadeIn = this.previewSampleFadeIn
sample.loopPointsEnabled = this.previewSampleLoopPointsEnabled
sample.loopStart = this.previewSampleLoopStart
sample.loopEnd = this.previewSampleLoopEnd
}
this.closeEditSampleForm() this.closeEditSampleForm()
this.infoSnackbarText = 'Sample Saved' this.infoSnackbarText = 'Sample Saved'
this.infoSnackbar = true this.infoSnackbar = true
@@ -760,6 +769,9 @@ export default {
this.profileMoreDialog = false this.profileMoreDialog = false
}, },
startRecording () { startRecording () {
// Save current profile before recording
this.updateProfile()
this.$http.get('/profiles/'.concat(this.recordedProfile.id)) this.$http.get('/profiles/'.concat(this.recordedProfile.id))
.then(async response => { .then(async response => {
if (response.status === 200) { if (response.status === 200) {