Skip to content

Lewis/dynamic field fix - #70

Merged
carhartlewis merged 6 commits into
mainfrom
lewis/dynamic-field-fix
Aug 6, 2026
Merged

Lewis/dynamic field fix#70
carhartlewis merged 6 commits into
mainfrom
lewis/dynamic-field-fix

Conversation

@carhartlewis

@carhartlewis carhartlewis commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary by cubic

Fixes dynamic field handling end-to-end, adds USER field support with validation, and makes field operations fully transactional. Also scopes agent backfill by entity and adds DB indexes and a user FK for better integrity and performance.

  • New Features

    • Transactional field updates for companies, contacts, and deals; batches roll back on failure.
    • USER fields: validate users exist, render owners in tables, and support Unassigned/Former member in sheets.
    • SELECT fields: show labels for retired options and prevent selecting them again; tables render labels, not option IDs.
    • Dates: accept only ISO 8601; consistent parsing and storage.
    • Agent backfill queues per-entity (“entity.key”), avoiding cross-entity collisions.
    • Fields list: optimistic drag reorder with rollback on error, targeted cache refresh, accessible labels, and an error state with retry.
    • Bulk actions: allow clearing owner/company to null; improved toasts.
  • Migration

    • Adds indexes on fieldValue (companyId, contactId, dealId, optionId, userId) and a FK fieldValue.userIduser (ON DELETE SET NULL).
    • Cleans up invalid userId values before enforcing the FK.
    • Run Prisma migrations to apply schema changes.

Written for commit c3b54bb. Summary will update on new commits.

Review in cubic

- Added new fields module with CRUD operations for custom fields.
- Introduced tools for creating, updating, archiving, and listing fields.
- Integrated field management into existing entities (companies, contacts, deals) for enhanced data handling.
- Updated contracts and services to support bulk operations for fields.
- Enhanced error handling and validation for field operations.
- Updated AgentTriggerService to include entity in field backfill method for improved logging and task management.
- Refactored CompaniesService, ContactsService, and DealsService to utilize transactions for field updates, ensuring consistency and error handling.
- Modified field handling in FieldsService to support new field value types and improved error translation.
- Enhanced test cases to cover new field management features and ensure robust functionality.
- Updated UI components to reflect changes in field management and improve user experience.
# Conflicts:
#	apps/api/src/agent/agent-trigger.service.ts
#	apps/api/src/companies/companies.service.ts
#	apps/api/src/contacts/contacts.service.ts
#	apps/api/src/deals/deals.contracts.ts
#	apps/api/src/deals/deals.router.ts
#	apps/api/src/deals/deals.service.ts
#	apps/api/src/fields/fields.contracts.ts
#	apps/api/src/fields/fields.service.ts
#	apps/api/src/generated/server.ts
#	apps/api/test/bulk.spec.ts
#	apps/api/test/fields.spec.ts
#	apps/app/components/crm/bulk-actions.tsx
#	apps/app/components/crm/fields/field-columns.tsx
#	apps/app/components/crm/fields/field-editor.tsx
#	apps/app/components/crm/fields/fields-copy.ts
#	apps/app/components/crm/fields/fields-list.tsx
#	apps/app/components/crm/fields/record-fields.tsx
#	apps/app/components/crm/inline-field.tsx
#	apps/app/components/crm/record-sheet/company-sheet.tsx
#	apps/app/components/crm/record-sheet/contact-sheet.tsx
#	apps/app/components/crm/record-sheet/deal-sheet.tsx
#	apps/app/lib/trpc/cache.ts
#	docs/plan/dynamic-fields-build.md
#	docs/plan/dynamic-fields.md
#	packages/db/prisma/schema.prisma
#	packages/db/src/fields-shape.ts
#	packages/db/src/fields.ts
#	packages/db/test/fields.spec.ts
#	packages/ui/src/components/data-table.tsx
#	packages/ui/src/components/sortable-list.tsx
#	packages/ui/src/hooks/use-table-selection.ts
- Updated FieldsService to allow passing a TransactionClient for database operations, enhancing flexibility in transaction management.
- Modified field rendering logic in field-columns component to support SELECT type fields with options.
- Enhanced fields-list component to include query client for better state management during field reordering.
- Refactored SortableList component to simplify drag-and-drop functionality and improve performance.
- Adjusted use-table-selection hook to ensure consistent key generation for row IDs.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
crm-agent Ready Ready Preview Aug 6, 2026 9:20pm
crm-api Ready Ready Preview Aug 6, 2026 9:20pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
crm-app Skipped Skipped Aug 6, 2026 9:20pm

Request Review

@vercel
vercel Bot temporarily deployed to Preview – crm-app August 6, 2026 21:20 Inactive
@carhartlewis
carhartlewis merged commit e025651 into main Aug 6, 2026
6 of 8 checks passed
@carhartlewis
carhartlewis deleted the lewis/dynamic-field-fix branch August 6, 2026 21:20
@github-actions github-actions Bot mentioned this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant