Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions resources/js/electron-plugin/dist/server/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import Store from "electron-store";
import { notifyLaravel } from "./utils.js";
const settingsStore = new Store();
settingsStore.onDidAnyChange((newValue, oldValue) => {
const changedKey = Object.keys(newValue).find((key) => newValue[key] !== oldValue[key]);
if (changedKey) {
const changedKeys = Object.keys(newValue).filter((key) => newValue[key] !== oldValue[key]);
changedKeys.forEach((key) => {
notifyLaravel("events", {
event: "Native\\Laravel\\Events\\Settings\\SettingChanged",
payload: {
key: changedKey,
value: newValue[changedKey] || null,
key,
value: newValue[key] || null,
},
});
}
});
});
function generateRandomString(length) {
let result = "";
Expand Down
12 changes: 5 additions & 7 deletions resources/js/electron-plugin/src/server/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ import { notifyLaravel } from "./utils.js";
const settingsStore = new Store();
settingsStore.onDidAnyChange((newValue, oldValue) => {
// Only notify of the changed key/value pair
const changedKey = Object.keys(newValue).find(
(key) => newValue[key] !== oldValue[key]
);
const changedKeys = Object.keys(newValue).filter((key) => newValue[key] !== oldValue[key]);

if (changedKey) {
changedKeys.forEach((key) => {
notifyLaravel("events", {
event: "Native\\Laravel\\Events\\Settings\\SettingChanged",
payload: {
key: changedKey,
value: newValue[changedKey] || null,
key,
value: newValue[key] || null,
},
});
}
});
});

interface State {
Expand Down
Loading