Skip to content

Commit

Permalink
feat: ignore devtools when sending actions to renderers (#275)
Browse files Browse the repository at this point in the history
Co-authored-by: Maciej Małkowski <monkey3310@gmail.com>
  • Loading branch information
sapkra and matmalkowski committed Oct 27, 2020
1 parent 0971fd3 commit c1a93c0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mainStateSyncEnhancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ function createMiddleware(options: MainStateSyncEnhancerOptions) {

// Forward it to all of the other renderers
webContents.getAllWebContents().forEach((contents) => {
// Ignore the renderer that sent the action
if (contents.id !== event.sender.id) {
// Ignore the renderer that sent the action and chromium devtools
if (
contents.id !== event.sender.id &&
!contents.getURL().startsWith('devtools://')
) {
contents.send('electron-redux.ACTION', localAction)
}
})
Expand All @@ -27,6 +30,8 @@ function createMiddleware(options: MainStateSyncEnhancerOptions) {
return (next) => (action) => {
if (validateAction(action)) {
webContents.getAllWebContents().forEach((contents) => {
// Ignore chromium devtools
if (contents.getURL().startsWith('devtools://')) return
contents.send('electron-redux.ACTION', action)
})
}
Expand Down

0 comments on commit c1a93c0

Please sign in to comment.