Skip to content

The open alternative to Salesforce, designed for AI.

Prevent self-hosting app from re-matching/re-creating people on no-op updates (#21406)

Marie6971d6fa95fd
diff --git a/packages/twenty-apps/internal/self-hosting/package.json b/packages/twenty-apps/internal/self-hosting/package.json
index 92fc3b132bd..1ed1c0cfb94 100644
--- a/packages/twenty-apps/internal/self-hosting/package.json
+++ b/packages/twenty-apps/internal/self-hosting/package.json
@@ -1,6 +1,6 @@
{
"name": "self-hosting",
- "version": "1.0.0",
+ "version": "1.0.1",
"license": "MIT",
"engines": {
"node": "^24.5.0",
diff --git a/packages/twenty-apps/internal/self-hosting/src/logic-functions/match-telemetry-event-with-people.ts b/packages/twenty-apps/internal/self-hosting/src/logic-functions/match-telemetry-event-with-people.ts
index 95d6c204720..90041be5cbb 100644
--- a/packages/twenty-apps/internal/self-hosting/src/logic-functions/match-telemetry-event-with-people.ts
+++ b/packages/twenty-apps/internal/self-hosting/src/logic-functions/match-telemetry-event-with-people.ts
@@ -1,6 +1,11 @@
-import { defineLogicFunction, type DatabaseEventPayload, type ObjectRecordCreateEvent, type ObjectRecordUpdateEvent } from 'twenty-sdk/define';
import { SELF_HOSTING_USER_NAME_SINGULAR } from 'src/objects/selfHostingUser.object';
import { CoreApiClient } from 'twenty-client-sdk/core';
+import {
+ defineLogicFunction,
+ type DatabaseEventPayload,
+ type ObjectRecordCreateEvent,
+ type ObjectRecordUpdateEvent,
+} from 'twenty-sdk/define';
type SelfHostingUser = {
id: string;
@@ -31,6 +36,17 @@ const handler = async (
return;
}
+ const existingPersonId = params.properties.after.personId;
+ const previousEmail =
+ 'before' in params.properties
+ ? params.properties.before?.email?.primaryEmail
+ : undefined;
+ const emailChanged = previousEmail !== email;
+
+ if (existingPersonId && !emailChanged) {
+ return;
+ }
+
const client = new CoreApiClient();
const { people } = await client.query({