fix(leads): replace string Convex mutation names with typed api.* handles#3292
fix(leads): replace string Convex mutation names with typed api.* handles#3292octo-patch wants to merge 1 commit into
Conversation
…dles Replaces 'contactMessages:submit' as any, 'registerInterest:register' as any, and 'userPreferences:*' as any with typed api.* function references from convex/_generated/api. This gives compile-time verification that the mutation exists with the expected arg shape and prevents silent breakage on rename. Fixes koala73#3253
|
Someone is attempting to deploy a commit to the World Monitor Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryReplaces string-literal Convex mutation/query names (cast as Confidence Score: 5/5Safe to merge — purely mechanical type-safety improvement with no runtime behavior change. All four typed handles are confirmed present in No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Client
participant H as Edge Handler
participant CV as ConvexHttpClient
participant DB as Convex DB
C->>H: HTTP Request (GET/POST)
H->>H: Auth & validate
H->>CV: client.query/mutation(api.*.*, args)
Note over H,CV: Previously: 'moduleName:fn' as any
Note over H,CV: Now: typed api.* handle (same wire call)
CV->>DB: Convex RPC
DB-->>CV: Result
CV-->>H: Typed response
H-->>C: JSON Response
Reviews (1): Last reviewed commit: "fix(leads): replace string Convex mutati..." | Re-trigger Greptile |
Fixes #3253
Problem
Three files called Convex mutations/queries using string-based names cast as
any:server/worldmonitor/leads/v1/submit-contact.ts:'contactMessages:submit' as anyserver/worldmonitor/leads/v1/register-interest.ts:'registerInterest:register' as anyapi/user-prefs.ts:'userPreferences:getPreferences' as anyand'userPreferences:setPreferences' as anyString-based mutation names bypass TypeScript type checking and break silently when mutations are renamed.
Solution
Import the generated
apiobject fromconvex/_generated/apiand replace each string name with its typedapi.*handle:'contactMessages:submit' as any→api.contactMessages.submit'registerInterest:register' as any→api.registerInterest.register'userPreferences:getPreferences' as any→api.userPreferences.getPreferences'userPreferences:setPreferences' as any→api.userPreferences.setPreferencesAlso removes the
// eslint-disable-next-line @typescript-eslint/no-explicit-anycomments inuser-prefs.tsthat were suppressing the linter warnings.Testing
convex/contactMessages.ts,convex/registerInterest.ts,convex/userPreferences.ts)convex/_generated/api.jsexportsapi = anyApiwhich correctly resolves typed handles at runtime