Skip to content

Commit

Permalink
Merge pull request #907 from intechstudio/feat/Analytics
Browse files Browse the repository at this point in the history
Fixed analytics bombardment on update action
  • Loading branch information
elsoazemelet authored Jan 20, 2025
2 parents 2c7451d + 4dcb8a0 commit c3b8168
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/renderer/runtime/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,35 +188,34 @@ export async function clearElement(target: GridElement) {
}

export async function syncWithGrid(target: GridAction) {
target.sendToGrid();
target.sendToGrid().finally(() => {
const event = target.parent as GridEvent;
const element = event.parent as GridElement;
Analytics.track({
event: "Config Action",
payload: {
click: "Update",
elementType: element.type,
eventType: event.type,
short: target.short,
},
mandatory: false,
});
});
}

export async function updateAction(
target: GridAction,
data: ActionData,
syncWithGrid: boolean
sync: boolean
) {
target
.updateData(data)
.then((result) => {
if (syncWithGrid) {
target.sendToGrid();
}
})
.catch(handleError)
.finally(() => {
const event = target.parent as GridEvent;
const element = event.parent as GridElement;
Analytics.track({
event: "Config Action",
payload: {
click: "Update",
elementType: element.type,
eventType: event.type,
short: target.short,
},
mandatory: false,
});
if (sync) {
syncWithGrid(target);
}
});
}

Expand Down

0 comments on commit c3b8168

Please sign in to comment.