Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(soup): setting previously undefined property to new value updated normy cache (#3381)
Seamusef37052a541b
diff --git a/js/app/packages/queries/properties/entity.ts b/js/app/packages/queries/properties/entity.tsindex 1bd96cd923..9ab2898562 100644--- a/js/app/packages/queries/properties/entity.ts+++ b/js/app/packages/queries/properties/entity.ts@@ -96,19 +96,35 @@ function optimisticUpdateSoupEntityProperty(const propertyDefinitionId = getPropertyDefinitionId(property);const existing = current.data.properties;- const isAlreadyAttached = existing.some(+ const existingProp = existing.find((prop) => prop.definition.id === propertyDefinitionId);- // If the property is already attached, swap its value. Otherwise append a- // fabricated SoupProperty so the row updates without waiting for the- // settled-refetch — necessary when editing a previously-unset property- // that the entity didn't ship with (e.g. via `buildStubProperty`).- const nextProperties: SoupProperty[] = isAlreadyAttached- ? existing.map((prop) =>- prop.definition.id === propertyDefinitionId ? { ...prop, value } : prop- )- : [...existing, fabricateSoupProperty(property, value)];+ const nextProp: SoupProperty = existingProp+ ? {+ ...existingProp,+ definition: {+ ...existingProp.definition,+ // HACK (seamus): we need to change something other than value in+ // order to get normy to update the cache. Changing+ // definition.updated_at is INCORRECT, but it's currently harmless.+ updated_at: new Date().toISOString(),+ },+ value,+ }+ : buildSoupProperty(property, value);++ const nextProperties = existing.map((prop) =>+ prop.definition.id === nextProp.definition.id ? nextProp : prop+ );++ if (+ nextProperties.every(+ (prop) => prop.definition.id !== nextProp.definition.id+ )+ ) {+ nextProperties.push(nextProp);+ }return optimisticUpdateSoupEntity({tag: current.tag,@@ -120,7 +136,7 @@ function optimisticUpdateSoupEntityProperty(});}-function fabricateSoupProperty(+function buildSoupProperty(property: Property | PropertyDefinitionDomain,value: SoupPropertyValue): SoupProperty {