Store/Settings: Propagate side effects to other existing windows
When syncing a setting between windows, if that setting has any side effects, a trigger is fired in all other windows to perform those side effects in their own environment.
This commit is contained in:
parent
b26e8b68ef
commit
b6bd3e6434
|
@ -286,11 +286,20 @@ const customActions = {
|
|||
})
|
||||
},
|
||||
|
||||
setUpListenerToSyncSettings: ({ commit, getters }) => {
|
||||
if (getters.getUsingElectron) {
|
||||
setUpListenerToSyncSettings: ({ commit, dispatch, getters }) => {
|
||||
const {
|
||||
getUsingElectron: usingElectron,
|
||||
settingHasSideEffects
|
||||
} = getters
|
||||
|
||||
if (usingElectron) {
|
||||
const { ipcRenderer } = require('electron')
|
||||
ipcRenderer.on('syncSetting', (_, setting) => {
|
||||
const { _id, value } = setting
|
||||
if (settingHasSideEffects(_id)) {
|
||||
dispatch(defaultSideEffectsTriggerId(_id), value)
|
||||
}
|
||||
|
||||
commit(defaultMutationId(_id), value)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue