Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
WalkthroughThis update refactors feed and newsletter data handling across UI and backend modules. It replaces the single Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI Component
participant DAL as Data Access Layer
participant DB as Database
UI->>DAL: getUserFeedsTimeline()
DAL->>DB: Query feeds, users_feeds, feeds_content, users_feeds_read_content
DB-->>DAL: Timeline data
DAL-->>UI: FeedTimeline[]
UI->>DAL: getUserFeedsWithContentsCount()
DAL->>DB: Query feeds, users_feeds, feeds_content (grouped by feed)
DB-->>DAL: Feeds with content counts
DAL-->>UI: FeedWithContentsCount[]
UI->>DAL: getUserNewsletters()
DAL->>DB: Query feeds filtered by newsletter ownership
DB-->>DAL: Newsletters
DAL-->>UI: Feed[]
UI->>DAL: triggerBackgroundSync([feedIds])
loop For each feedId
DAL->>DB: Fetch feed by ID
DB-->>DAL: Feed data
DAL->>FeedParser: Parse feed URL
FeedParser-->>DAL: New content, title
DAL->>DB: Update feed, insert new content
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Vercel Preview URL 🚀 : https://bocal-bvuw2vtua-euuuuhs-projects.vercel.app |
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
src/app/[locale]/(app)/d/feeds/page.tsx(2 hunks)src/app/[locale]/(app)/d/newsletters/page.tsx(1 hunks)src/app/[locale]/lib/dal.ts(2 hunks)src/app/[locale]/lib/feed-service.ts(2 hunks)src/app/[locale]/lib/types.ts(1 hunks)src/app/[locale]/ui/feeds/feed-context-menu.tsx(1 hunks)src/app/[locale]/ui/feeds/feed-info-context-menu.tsx(2 hunks)src/app/[locale]/ui/feeds/feeds-info-menu.tsx(5 hunks)src/app/[locale]/ui/feeds/feeds-timeline.tsx(1 hunks)src/app/[locale]/ui/newsletters/newsletter-item.tsx(2 hunks)src/app/[locale]/ui/newsletters/newsletters.tsx(1 hunks)src/db/schema.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
src/app/[locale]/ui/feeds/feed-context-menu.tsx (2)
Learnt from: mtlaso
PR: mtlaso/bocal#98
File: src/app/[locale]/(app)/feed/page.tsx:54-54
Timestamp: 2025-04-08T06:37:10.493Z
Learning: React's `cache()` function imported from 'react' is specifically designed for Server Components in Next.js and doesn't require the "use client" directive. It's used to deduplicate data fetching calls within a single request and can only be used in Server Components, not Client Components.
Learnt from: mtlaso
PR: mtlaso/bocal#98
File: src/app/[locale]/(app)/feed/page.tsx:54-54
Timestamp: 2025-04-08T06:37:10.493Z
Learning: React's `cache` function imported from 'react' can be used in Next.js server components without requiring "use client" directive. It's specifically designed to deduplicate data requests in server components.
src/app/[locale]/lib/dal.ts (2)
Learnt from: mtlaso
PR: mtlaso/bocal#176
File: src/app/[locale]/lib/actions.ts:739-745
Timestamp: 2025-06-18T09:37:41.932Z
Learning: In the codebase using Drizzle ORM, DELETE queries using `db.delete().where()` work without requiring the `.execute()` method call at the end. Both `await db.delete(feeds).where(...)` and `await db.delete(feeds).where(...).execute()` are valid patterns.
Learnt from: mtlaso
PR: mtlaso/bocal#176
File: src/app/[locale]/lib/dal.ts:127-131
Timestamp: 2025-06-18T09:35:19.881Z
Learning: In Drizzle ORM, sql.raw() works correctly within quoted strings inside sql tagged template literals. The pattern `sql`AND f.URL LIKE '${sql.raw(constant)}%'`` is valid and functional - the ${} placeholders are processed by Drizzle's SQL processor, not JavaScript string interpolation, so sql.raw() is properly handled even within quoted contexts.
🧬 Code Graph Analysis (5)
src/app/[locale]/(app)/d/newsletters/page.tsx (1)
src/app/[locale]/lib/dal.ts (1)
dal(210-216)
src/app/[locale]/ui/feeds/feed-info-context-menu.tsx (2)
src/app/[locale]/lib/types.ts (1)
FeedWithContentsCount(1-7)src/app/[locale]/lib/userfeeds-funcs.ts (1)
userfeedsfuncs(52-56)
src/app/[locale]/ui/newsletters/newsletters.tsx (3)
src/db/schema.ts (1)
Feed(337-337)src/lib/utils.ts (1)
cn(4-6)src/app/[locale]/ui/spacing.ts (1)
SPACING(1-7)
src/app/[locale]/ui/feeds/feeds-timeline.tsx (4)
src/db/schema.ts (1)
FeedTimeline(338-338)src/app/[locale]/lib/stores/search-params-states.ts (1)
searchParamsState(35-42)src/lib/utils.ts (1)
cn(4-6)src/app/[locale]/ui/spacing.ts (1)
SPACING(1-7)
src/app/[locale]/lib/dal.ts (6)
src/db/schema.ts (6)
FeedTimeline(338-338)feedsTimelineSchema(334-334)feeds(72-99)feedsContent(104-124)usersFeeds(129-140)Feed(337-337)src/db/db.ts (1)
db(24-24)src/app/[locale]/lib/logging.ts (1)
logger(34-38)src/app/[locale]/lib/feed-service.ts (1)
feedService(352-360)src/app/[locale]/lib/types.ts (1)
FeedWithContentsCount(1-7)src/app/[locale]/lib/userfeeds-funcs.ts (1)
userfeedsfuncs(52-56)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Create Neon Branch
🔇 Additional comments (24)
src/app/[locale]/lib/types.ts (1)
1-7: LGTM! Well-structured type definition.The new
FeedWithContentsCounttype is cleanly defined with appropriate field types and follows TypeScript naming conventions. The structure aligns well with the feed data refactoring mentioned in the PR summary.src/app/[locale]/ui/feeds/feed-context-menu.tsx (1)
1-1: Correct addition of client directive.The "use client" directive is appropriately added since this component uses client-side React features like
useTransition, toast notifications, and user interaction handlers.src/app/[locale]/(app)/d/newsletters/page.tsx (1)
52-52: Approve: Specialized newsletter fetch method verified
- Confirmed
getUserNewslettersis defined insrc/app/[locale]/lib/dal.tsand returns aPromise<Feed[]>.- No remaining calls to
getUserFeedswith a newsletters filter.- This refactoring cleanly replaces the generic feed call with a dedicated newsletter method.
All good to merge.
src/app/[locale]/ui/newsletters/newsletter-item.tsx (2)
31-31: Type update aligns with refactoring.The import change from
FeedWithContenttoFeedis consistent with the broader refactoring described in the PR summary.
33-33: No action required: Feed type includes all required propertiesThe
Feedmodel inferred fromsrc/db/schema.tsincludesid,eid,url, andtitle(among other fields), so no changes are needed here.src/app/[locale]/ui/newsletters/newsletters.tsx (2)
4-5: Consistent type and utility updates.The changes align well with the refactoring:
- Import updated from
FeedWithContenttoFeedtype- Added
cnutility for better class composition- Prop type updated consistently
Also applies to: 8-8
14-14: Improved styling with proper class composition.Good use of the
cnutility to combine Tailwind classes with the spacing constant. The new flex layout ("flex flex-col gap-4") withSPACING.MDshould provide better visual organization.src/app/[locale]/ui/feeds/feed-info-context-menu.tsx (3)
9-10: LGTM: Type and import updates are consistent with the refactor.The type change from
Feed[]toFeedWithContentsCount[]and the addition ofuserfeedsfuncsimport align with the broader refactoring effort. These changes maintain type safety while supporting the new data structure.
22-22: LGTM: Props type correctly updated.The props type change to
FeedWithContentsCount[]is consistent with the new data structure and matches the import on line 9.
108-108: LGTM: URL formatting enhancement.The addition of
userfeedsfuncs.formatFeedURL(url)before copying to clipboard is a good enhancement that ensures consistent URL formatting. This aligns with the utility function imported on line 10.src/app/[locale]/(app)/d/feeds/page.tsx (3)
7-8: LGTM: Component imports updated for refactored architecture.The import changes from
FeedInfoMenu/FeedstoFeedsInfoMenu/FeedsTimelinecorrectly reflect the component renaming and refactored data structure approach.
56-65: LGTM: Efficient parallel data fetching with proper prop distribution.The refactor to fetch
getUserFeedsTimelineandgetUserFeedsWithContentsCountconcurrently usingPromise.allis efficient and aligns with the new data structure. The props are correctly passed to theFeedsInfoMenucomponent.
69-70: LGTM: Simplified data fetching for timeline component.The
FeedsWrappercorrectly fetches only the timeline data needed for theFeedsTimelinecomponent, maintaining separation of concerns.src/app/[locale]/ui/feeds/feeds-timeline.tsx (4)
17-17: LGTM: Component renamed and properly typed for timeline structure.The component name change from
FeedstoFeedsTimelineand the type change toFeedTimeline[]correctly reflect the new timeline-based data structure.Also applies to: 22-22, 25-25
30-33: LGTM: Filtering logic correctly updated for timeline structure.The filtering logic properly adapts to the new timeline structure by filtering on
el.feedIdinstead of the previous nested structure. The logic maintains the same behavior for selected feed filtering.
37-41: LGTM: Simplified rendering approach for timeline items.The rendering logic is correctly simplified for the flat timeline structure. The null check for
item.contentis appropriate, and the direct mapping eliminates the previous nested iteration complexity.
45-45: LGTM: Item component type correctly updated.The
Itemcomponent's prop type is correctly updated fromFeedContentWithReadAttoFeedTimeline, maintaining type consistency with the new data structure.src/db/schema.ts (2)
325-332: LGTM: Well-structured timeline schema with comprehensive feed metadata.The
feedTimelineschema correctly extends the existingfeedsContentschema and adds essential feed metadata fields (feedTitle,feedUrl,feedErrorType,feedLastSyncAt). The nullablefeedErrorTypeand coerced date types are appropriately typed.
334-334: LGTM: Consistent schema and type exports for timeline structure.The
feedsTimelineSchemaarray export andFeedTimelinetype export properly support the new timeline-based data structure and replace the removed composite types.Also applies to: 338-338
src/app/[locale]/ui/feeds/feeds-info-menu.tsx (3)
7-7: LGTM: Component renamed and props properly structured for dual data sources.The component rename to
FeedsInfoMenuand the new props structure accepting bothtimelineanduserFeedsWithContentsCountcorrectly implement the separation of timeline and content count data. The type imports are consistent with the new data structures.Also applies to: 19-19, 23-25, 27-30
34-34: LGTM: Efficient data usage and calculation simplification.The assignment of
feedsfromuserFeedsWithContentsCountand the use oftimeline.lengthfor total content calculation properly leverage the new data structure while simplifying the logic.Also applies to: 53-53
143-143: LGTM: Prop type and content count display correctly updated.The
FeedMenuItemcomponent's prop type change toFeedWithContentsCountand the use offeed.contentsCountinstead offeed.contents.lengthproperly adapt to the new data structure and provide the same functionality.Also applies to: 176-176
src/app/[locale]/lib/dal.ts (2)
138-168: LGTM!The function correctly implements feed retrieval with content counts using proper joins and grouping.
170-205: LGTM!The function correctly filters and returns user newsletters with appropriate authorization checks.
|
Vercel Preview URL 🚀 : https://bocal-lxv4pd501-euuuuhs-projects.vercel.app |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores