fix(14-03): remove dead onSubmit branch in SendQuoteModal (CRM-12)
- Remove unreachable if (tab === "new") branch in onSubmit - the new-tab button has its own onClick navigation and never triggers form submit - Escape unescaped double quotes in JSX text (react/no-unescaped-entities) - generate_new field left as-is per plan (optional cleanup, out of scope) - Log pre-existing useForm<any>/onSubmit(data: any) no-explicit-any lint errors to deferred-items.md (out of scope: fixing requires resolving a zodResolver/Resolver generic incompatibility with assignQuoteSchema's optional/default fields)
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# Deferred Items — Phase 14 (crm-attio-style-fix)
|
||||||
|
|
||||||
|
Items discovered during execution that are out of scope for the current task/plan and deferred for future cleanup.
|
||||||
|
|
||||||
|
## From Plan 14-03
|
||||||
|
|
||||||
|
| File | Lines | Issue | Reason Deferred |
|
||||||
|
|------|-------|-------|------------------|
|
||||||
|
| `src/components/admin/leads/SendQuoteModal.tsx` | 39, 48 | `@typescript-eslint/no-explicit-any` on `useForm<any>()` and `onSubmit(data: any)` | Pre-existing (not introduced by CRM-12's dead-branch removal). Attempted fix: typing `useForm<AssignQuoteInput>()` with `AssignQuoteInput = z.infer<typeof assignQuoteSchema>` (local schema has `.optional()`/`.default()` on `generate_new`) triggers a cascading `zodResolver`/`Resolver<...>` generic-incompatibility TS error (3 errors, TS2322/TS2345) between `@hookform/resolvers/zod` and `react-hook-form@7.75`'s 3-generic `Resolver` type — same family of issue fixed for `LeadForm.tsx`'s `FormField` in 14-03 Task 2, but here it surfaces in the resolver/schema layer (input vs output type divergence from `.default()`), not the `FormField` component. Resolving it would require either restructuring `assignQuoteSchema`'s optional/default fields or adding resolver-boundary type assertions — out of scope for CRM-12 (isolated dead-code removal). |
|
||||||
@@ -48,12 +48,6 @@ export function SendQuoteModal({ leadId }: { leadId: string }) {
|
|||||||
async function onSubmit(data: any) {
|
async function onSubmit(data: any) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
if (tab === "new") {
|
|
||||||
// Redirect to quote builder pre-filled with this lead
|
|
||||||
window.location.href = `/admin/quotes/new?lead_id=${leadId}`;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await assignQuoteToLead({
|
const result = await assignQuoteToLead({
|
||||||
lead_id: leadId,
|
lead_id: leadId,
|
||||||
quote_token: data.quote_token,
|
quote_token: data.quote_token,
|
||||||
@@ -109,7 +103,7 @@ export function SendQuoteModal({ leadId }: { leadId: string }) {
|
|||||||
/>
|
/>
|
||||||
<p className="text-xs text-gray-600">
|
<p className="text-xs text-gray-600">
|
||||||
Copia il token dal preventivo e incollalo qui. Il lead sarà aggiornato a
|
Copia il token dal preventivo e incollalo qui. Il lead sarà aggiornato a
|
||||||
"Proposal Sent".
|
"Proposal Sent".
|
||||||
</p>
|
</p>
|
||||||
<Button type="submit" disabled={loading} className="w-full">
|
<Button type="submit" disabled={loading} className="w-full">
|
||||||
{loading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
{loading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
||||||
|
|||||||
Reference in New Issue
Block a user