Skip to content

Commit

Permalink
Initialize audio store before importing SW1/SW2 urls
Browse files Browse the repository at this point in the history
Invalidate cache when navigating away from the main view.

ref #779
  • Loading branch information
frostburn committed Jul 15, 2024
1 parent d292ec4 commit 24e1435
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ onMounted(async () => {
// Scale Workshop 1 compatibility
try {
const scaleWorkshopOneData = new ScaleWorkshopOneData()
audio.initialize()
scale.name = scaleWorkshopOneData.name
scale.userBaseFrequency = scaleWorkshopOneData.freq
Expand Down Expand Up @@ -405,6 +406,7 @@ onMounted(async () => {
// Scale Workshop 2 compatibility
try {
const decodedState = decodeQuery(query)
audio.initialize()
let pianoMode: 'Asdf' | 'QweZxc' = 'Asdf'
if (decodedState.pianoMode === 'QweZxc0' || decodedState.pianoMode === 'QweZxc1') {
Expand Down
7 changes: 6 additions & 1 deletion src/views/ScaleView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useScaleStore } from '@/stores/scale'
import { useStateStore } from '@/stores/state'
import { debounce } from '@/utils'
import { getSourceVisitor, setNumberOfComponents } from 'sonic-weave'
import { onMounted, ref } from 'vue'
import { onMounted, onUnmounted, ref } from 'vue'
const scale = useScaleStore()
const state = useStateStore()
Expand All @@ -26,6 +26,11 @@ onMounted(() => {
setNumberOfComponents(DEFAULT_NUMBER_OF_COMPONENTS)
setTimeout(() => getSourceVisitor(), 1)
})
onUnmounted(() => {
// Prepare to include other state in the server payload
scale.rerollId()
})
</script>

<template>
Expand Down

0 comments on commit 24e1435

Please sign in to comment.