Conversation
…dules Add focused tests for critical logic in http-manager, react client, and server handlers. Remove clearMemoryStore from public exports as it's only needed internally for testing. Co-Authored-By: Claude Haiku 4.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryAdded comprehensive notification management system with type-safe inbox support. The implementation includes a core manager with memory adapter, HTTP client for browser use, React hooks/context for UI integration, and Next.js server handlers for API routes. Key architectural decisions:
Implementation highlights:
Confidence Score: 5/5
|
| async markManyAsRead(ids: string[]): Promise<void> { | ||
| await Promise.all(ids.map((id) => manager.markAsRead(id))); | ||
| }, |
There was a problem hiding this comment.
style: markManyAsRead uses Promise.all with individual markAsRead calls, triggering separate API requests for each ID. Consider adding a batch endpoint /read-many for better performance with large ID arrays
| async markManyAsRead(ids: string[]): Promise<void> { | |
| await Promise.all(ids.map((id) => manager.markAsRead(id))); | |
| }, | |
| async markManyAsRead(ids: string[]): Promise<void> { | |
| await request( | |
| baseUrl, | |
| "/read-many", | |
| { | |
| method: "POST", | |
| body: JSON.stringify({ ids }), | |
| }, | |
| fetchFn, | |
| deserializeFn | |
| ); | |
| }, |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/notification/src/client/http-manager.ts
Line: 271:273
Comment:
**style:** `markManyAsRead` uses `Promise.all` with individual `markAsRead` calls, triggering separate API requests for each ID. Consider adding a batch endpoint `/read-many` for better performance with large ID arrays
```suggestion
async markManyAsRead(ids: string[]): Promise<void> {
await request(
baseUrl,
"/read-many",
{
method: "POST",
body: JSON.stringify({ ids }),
},
fetchFn,
deserializeFn
);
},
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| async deleteMany(filter: Omit<NotificationFilter<Types>, "userId">): Promise<number> { | ||
| // List matching notifications and delete each | ||
| const notifications = await manager.list(filter); | ||
| await Promise.all(notifications.map((n) => manager.delete(n.id))); | ||
| return notifications.length; | ||
| }, |
There was a problem hiding this comment.
style: deleteMany lists all matching notifications client-side then deletes individually. For large result sets, consider adding a server endpoint that performs bulk deletion to reduce network overhead
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/notification/src/client/http-manager.ts
Line: 322:327
Comment:
**style:** `deleteMany` lists all matching notifications client-side then deletes individually. For large result sets, consider adding a server endpoint that performs bulk deletion to reduce network overhead
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.- Fix non-null assertions by adding proper type guards - Remove unused variables and functions (filterKey, serializeFilter, NextResponse) - Add htmlFor attributes to labels for accessibility - Replace forEach with for...of to avoid implicit returns - Remove unused imports Co-Authored-By: Claude Haiku 4.5 <[email protected]>
- Add getId handler for server-side auth context - Remove userId from HTTP client calls (determined server-side) - Fix data type from unknown to Record<string, unknown> Co-Authored-By: Claude Opus 4.5 <[email protected]>
…ientId
- Rename package from @jlnstack/notification to @jlnstack/notifications
- Refactor send() API from send(type, options) to send({ type, ...options })
- Rename userId to recipientId throughout to support notifications to
any entity type (users, workspaces, teams, etc.)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add parseNotificationData function that validates data through Standard Schema - Add NotificationValidationError class with descriptive error messages - Require all notification type schemas to implement Standard Schema (Zod, Valibot, etc.) - Return 400 Bad Request for validation errors in server handlers - Add comprehensive tests for schema validation behavior Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
Complete notification management system with type-safe inbox support. Includes core manager with memory adapter, HTTP client for browser use, React hooks/context for UI integration, and Next.js server handlers for API routes.
Key Features
🤖 Generated with Claude Code