Skip to content

Commit

Permalink
fix: IStore is not equal to Redux store. Changed to only parse needed…
Browse files Browse the repository at this point in the history
… part of state
  • Loading branch information
olzzon committed Jan 29, 2024
1 parent 22b7aae commit 599f833
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions server/src/utils/labels.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { IStore } from '../../../shared/src/reducers/store'
import { IchMixerConnection } from '../../../shared/src/reducers/channelsReducer'
import { state } from '../reducers/store'

export function getChannelLabel(
state: IStore,
chMixerConnection: IchMixerConnection[],
faderIndex: number
): string | undefined {
return state.channels[0].chMixerConnection
return chMixerConnection
.map((conn) =>
conn.channel.map((ch) => ({
assignedFader: ch.assignedFader,
label: ch.label,
conn?.channel.map((ch) => ({
assignedFader: ch?.assignedFader,
label: ch?.label,
}))
)
.reduce((a, b) => [...a, ...b], []) // flatten
Expand All @@ -28,7 +28,7 @@ export function getFaderLabel(faderIndex: number, defaultName = 'CH'): string {
state.faders[0].fader[faderIndex].userLabel !== ''
? state.faders[0].fader[faderIndex].userLabel
: undefined
const channelLabel = getChannelLabel(state, faderIndex)
const channelLabel = getChannelLabel(state.channels[0].chMixerConnection, faderIndex)

switch (state.settings[0].labelType) {
case 'automation':
Expand Down

0 comments on commit 599f833

Please sign in to comment.