Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(tags): exclude Tag definitions from property pickers (#4654)

gbirmanbc350704549f
diff --git a/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx b/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
index f8566af57f..59d5d7ad02 100644
--- a/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
+++ b/js/app/packages/app/component/property-edit-modal/PropertyEditorModal.tsx
@@ -365,7 +365,7 @@ function PropertyValueEditor(props: {
value: string | number | boolean | Date | EntityReference
) => {
const type = propertyType();
- if (!type) return;
+ if (!type || type === 'TAG') return;
let apiValues = toPropertyApiValue({ valueType: type }, value);
if (!apiValues) return;
props.onSave(apiValues);
diff --git a/js/app/packages/property/src/hooks/usePropertySelection.ts b/js/app/packages/property/src/hooks/usePropertySelection.ts
index a600e362e8..f10fa99479 100644
--- a/js/app/packages/property/src/hooks/usePropertySelection.ts
+++ b/js/app/packages/property/src/hooks/usePropertySelection.ts
@@ -24,7 +24,10 @@ export function usePropertySelection(
property.id &&
!existingIds.has(property.id) &&
// COMPANY entity properties not yet implemented
- property.specificEntityType !== 'COMPANY'
+ property.specificEntityType !== 'COMPANY' &&
+ // Tag definitions are managed through the dedicated Tags UI, never the
+ // generic property pickers.
+ property.valueType !== 'TAG'
);
// Then apply search filter
diff --git a/js/app/packages/property/src/types.ts b/js/app/packages/property/src/types.ts
index ac8959d6d7..69a5045ab4 100644
--- a/js/app/packages/property/src/types.ts
+++ b/js/app/packages/property/src/types.ts
@@ -15,6 +15,7 @@
*/
import type { BlockName } from '@core/block';
import type { DateValue } from '@core/util/date';
+import type { DataType } from '@service-properties/generated/schemas/dataType';
import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
import type { EntityType } from '@service-properties/generated/schemas/entityType';
import type { PropertyOption } from '@service-properties/generated/schemas/propertyOption';
@@ -103,8 +104,9 @@ export type SelectProperty = SelectStringProperty | SelectNumberProperty;
* This is the UI layer representation of a property definition.
* Use `toPropertyDefinitionDomain` to transform from API types.
*
- * Note: Uses `valueType` to match the `Property` type, enabling shared
- * components like `PropertyDataTypeIcon` to work with both types.
+ * Note: `valueType` carries the definition's full `DataType` (including
+ * `TAG`), a superset of the narrow value discriminator on `Property`. The
+ * shared name lets components like `PropertyDataTypeIcon` accept both types.
*
* @see PropertyDefinition - Generated API type (snake_case)
* @see Property - Domain type for property instances with values
@@ -112,7 +114,7 @@ export type SelectProperty = SelectStringProperty | SelectNumberProperty;
export type PropertyDefinitionDomain = {
id: string;
displayName: string;
- valueType: ValueType;
+ valueType: DataType;
isMultiSelect: boolean;
isMetadata: boolean;
isSystem: boolean;
diff --git a/js/app/packages/property/src/utils/PropertyDataTypeIcon.tsx b/js/app/packages/property/src/utils/PropertyDataTypeIcon.tsx
index 271181d1ec..91c859c601 100644
--- a/js/app/packages/property/src/utils/PropertyDataTypeIcon.tsx
+++ b/js/app/packages/property/src/utils/PropertyDataTypeIcon.tsx
@@ -17,10 +17,10 @@ import type { Component } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { twMerge } from 'tailwind-merge';
import { match } from 'ts-pattern';
-import type { Property } from '../types';
+import type { PropertyDefinitionDomain } from '../types';
const EntityDataTypeIcon: Component<{
- property: Pick<Property, 'specificEntityType'>;
+ property: Pick<PropertyDefinitionDomain, 'specificEntityType'>;
class?: string;
}> = (props) => {
const iconClass = () => twMerge('size-4 text-ink-muted', props.class);
@@ -40,7 +40,7 @@ const EntityDataTypeIcon: Component<{
};
export const PropertyDataTypeIcon: Component<{
- property: Pick<Property, 'valueType' | 'specificEntityType'>;
+ property: Pick<PropertyDefinitionDomain, 'valueType' | 'specificEntityType'>;
class?: string;
}> = (props) => {
const iconClass = () => twMerge('size-4 text-ink-muted', props.class);
diff --git a/js/app/packages/property/src/utils/transforms.ts b/js/app/packages/property/src/utils/transforms.ts
index 9200b22804..6275c2bbb2 100644
--- a/js/app/packages/property/src/utils/transforms.ts
+++ b/js/app/packages/property/src/utils/transforms.ts
@@ -1,7 +1,6 @@
import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
import type { PropertyOption } from '@service-properties/generated/schemas/propertyOption';
-import { nanoid } from 'nanoid';
-import type { Property, PropertyDefinitionDomain, ValueType } from '../types';
+import type { PropertyDefinitionDomain } from '../types';
/**
* Transforms a backend PropertyDefinition (snake_case) to the frontend
@@ -20,7 +19,7 @@ export function toPropertyDefinitionDomain(
return {
id: definition.id,
displayName: definition.display_name,
- valueType: definition.data_type as ValueType,
+ valueType: definition.data_type,
isMultiSelect: definition.is_multi_select,
isMetadata: definition.is_metadata,
isSystem: definition.is_system,
@@ -31,23 +30,3 @@ export function toPropertyDefinitionDomain(
updatedAt: definition.updated_at,
};
}
-
-function _propertyDefinitionDomainToProperty(
- propertyDefinition: PropertyDefinitionDomain
-): Property {
- return {
- propertyId: nanoid(8),
- propertyDefinitionId: propertyDefinition.id,
- displayName: propertyDefinition.displayName,
- isMultiSelect: propertyDefinition.isMultiSelect,
- isMetadata: propertyDefinition.isMetadata,
- isSystemProperty: propertyDefinition.isSystem,
- options: propertyDefinition.options,
- owner: propertyDefinition.owner,
- specificEntityType: propertyDefinition.specificEntityType,
- createdAt: propertyDefinition.createdAt,
- updatedAt: propertyDefinition.updatedAt,
- valueType: propertyDefinition.valueType,
- value: null,
- };
-}