File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed
resources/js/electron-plugin Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,16 @@ import Store from "electron-store";
22import { notifyLaravel } from "./utils.js" ;
33const settingsStore = new Store ( ) ;
44settingsStore . onDidAnyChange ( ( newValue , oldValue ) => {
5- const changedKey = Object . keys ( newValue ) . find ( ( key ) => newValue [ key ] !== oldValue [ key ] ) ;
6- if ( changedKey ) {
5+ const changedKeys = Object . keys ( newValue ) . filter ( ( key ) => newValue [ key ] !== oldValue [ key ] ) ;
6+ changedKeys . forEach ( ( key ) => {
77 notifyLaravel ( "events" , {
88 event : "Native\\Laravel\\Events\\Settings\\SettingChanged" ,
99 payload : {
10- key : changedKey ,
11- value : newValue [ changedKey ] || null ,
10+ key,
11+ value : newValue [ key ] || null ,
1212 } ,
1313 } ) ;
14- }
14+ } ) ;
1515} ) ;
1616function generateRandomString ( length ) {
1717 let result = "" ;
Original file line number Diff line number Diff line change @@ -5,19 +5,17 @@ import { notifyLaravel } from "./utils.js";
55const settingsStore = new Store ( ) ;
66settingsStore . onDidAnyChange ( ( newValue , oldValue ) => {
77 // Only notify of the changed key/value pair
8- const changedKey = Object . keys ( newValue ) . find (
9- ( key ) => newValue [ key ] !== oldValue [ key ]
10- ) ;
8+ const changedKeys = Object . keys ( newValue ) . filter ( ( key ) => newValue [ key ] !== oldValue [ key ] ) ;
119
12- if ( changedKey ) {
10+ changedKeys . forEach ( ( key ) => {
1311 notifyLaravel ( "events" , {
1412 event : "Native\\Laravel\\Events\\Settings\\SettingChanged" ,
1513 payload : {
16- key : changedKey ,
17- value : newValue [ changedKey ] || null ,
14+ key,
15+ value : newValue [ key ] || null ,
1816 } ,
1917 } ) ;
20- }
18+ } ) ;
2119} ) ;
2220
2321interface State {
You can’t perform that action at this time.
0 commit comments