Skip to content

Commit

Permalink
fix(overmind-devtools-client): fixed issue with derived on classes
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Sep 1, 2020
1 parent f5870ec commit 6fa86cb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@ export const updateDerived: () => Operator<DerivedMessage> = () =>
const actualPath = Array.isArray(message.data.path) ? message.data.path : (message.data.path as any).split('.')
const path = actualPath.slice()
const key = path.pop()
const target = path.reduce((aggr, pathKey) => aggr[pathKey], appState)
target[key] = message.data.value
const target = path.reduce((aggr, pathKey) => aggr && aggr['__CLASS__'] ? aggr[pathKey].value : aggr[pathKey], appState)

if (target['__CLASS__']) {
target.value[key] = message.data.value
} else {
target[key] = message.data.value
}

state.apps[message.appName].derived[actualPath.join(state.apps[message.appName].delimiter)] = message.data
})
Expand Down

0 comments on commit 6fa86cb

Please sign in to comment.