Use same key for replaygain's preAmp (#3184)
Resolves #2933. To prevent this from happening again, make the localstorage keys consts for set/get
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
import { CHANGE_GAIN, CHANGE_PREAMP } from '../actions'
|
import { CHANGE_GAIN, CHANGE_PREAMP } from '../actions'
|
||||||
|
|
||||||
|
const GAIN_KEY = 'gainMode'
|
||||||
|
const PREAMP_KEY = 'preAmp'
|
||||||
|
|
||||||
const getPreAmp = () => {
|
const getPreAmp = () => {
|
||||||
const storage = localStorage.getItem('preamp')
|
const storage = localStorage.getItem(PREAMP_KEY)
|
||||||
|
|
||||||
if (storage === null) {
|
if (storage === null) {
|
||||||
return 0
|
return 0
|
||||||
@@ -12,7 +15,7 @@ const getPreAmp = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
gainMode: localStorage.getItem('gainMode') || 'none',
|
gainMode: localStorage.getItem(GAIN_KEY) || 'none',
|
||||||
preAmp: getPreAmp(),
|
preAmp: getPreAmp(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +25,7 @@ export const replayGainReducer = (
|
|||||||
) => {
|
) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CHANGE_GAIN: {
|
case CHANGE_GAIN: {
|
||||||
localStorage.setItem('gainMode', payload)
|
localStorage.setItem(GAIN_KEY, payload)
|
||||||
return {
|
return {
|
||||||
...previousState,
|
...previousState,
|
||||||
gainMode: payload,
|
gainMode: payload,
|
||||||
@@ -33,7 +36,7 @@ export const replayGainReducer = (
|
|||||||
if (isNaN(value)) {
|
if (isNaN(value)) {
|
||||||
return previousState
|
return previousState
|
||||||
}
|
}
|
||||||
localStorage.setItem('preAmp', payload)
|
localStorage.setItem(PREAMP_KEY, payload)
|
||||||
return {
|
return {
|
||||||
...previousState,
|
...previousState,
|
||||||
preAmp: value,
|
preAmp: value,
|
||||||
|
|||||||
Reference in New Issue
Block a user