Skip to content

Refactors create feed flow, steps use router#188

Merged
elliotBraem merged 10 commits intostagingfrom
feat/better-feed-form
Jun 21, 2025
Merged

Refactors create feed flow, steps use router#188
elliotBraem merged 10 commits intostagingfrom
feat/better-feed-form

Conversation

@elliotBraem
Copy link
Collaborator

@elliotBraem elliotBraem commented Jun 21, 2025

Uses router for steps

Summary by CodeRabbit

  • New Features

    • Introduced a multi-step feed creation flow with separate steps for basic information, settings, and review, using structured forms and progress indicators.
    • Added Telegram publishing integration and content approvers management to the feed creation process.
    • Implemented moderation permission checks for feeds.
  • Improvements

    • Enhanced error handling with clearer messages and more consistent API responses.
    • Improved form management and validation using modern form libraries for a smoother user experience.
    • Refined state management for feed creation, allowing more flexible and robust configuration.
  • Bug Fixes

    • Fixed inconsistencies in feed data handling, especially around updating and deleting feeds.
  • Chores

    • Updated and added dependencies for better form handling, immutability, and utility functions.
    • Improved internal structure for validation and error reporting.
  • Refactor

    • Migrated feed creation logic to a step-based route structure and modernized form state handling.
    • Simplified and unified error classes and response schemas for API endpoints.
  • Documentation

    • Updated and clarified type definitions and validation schemas for feeds and configurations.

@vercel
Copy link

vercel bot commented Jun 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
curatedotfun-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2025 6:16pm

@coderabbitai
Copy link

coderabbitai bot commented Jun 21, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update refactors the feed API, backend services, error handling, and frontend feed creation flow. It introduces Zod-based validation schemas, streamlines error classes, updates service and repository method signatures, and restructures the frontend feed creation process into a multi-step, form-driven workflow. Type safety and response consistency are enhanced throughout.

Changes

Files/Groups Change Summary
apps/api/src/routes/api/feeds.ts, apps/api/src/services/feed.service.ts, apps/api/src/types/errors.ts Refactored feed API routes and service methods to use Zod schemas for validation, standardized error handling with new error classes, and updated service access patterns. Method signatures updated for create, update, and delete operations.
packages/shared-db/src/repositories/feed.repository.ts, packages/shared-db/src/schema/feeds.ts, packages/shared-db/src/validators.ts Updated repository method names and signatures, improved cascading deletes, switched to drizzle-zod for schema generation, and removed manual feed config schemas.
packages/types/src/api/feeds.ts, packages/types/src/config.ts, packages/types/src/index.ts Added new API request/response schemas and types for feeds, relaxed some config validation constraints, and updated exports.
apps/app/src/store/feed-creation-store.ts Refactored store to center around a nested feedConfig object, using Immer for immutable updates and lodash for deep property setting.
apps/app/src/components/ContentApprovers.tsx, apps/app/src/components/PublishIntegrations.tsx Migrated from custom store state management to react-hook-form for controlled form field management in feed creation steps.
apps/app/src/components/ui/tanstack-form.tsx Added new form system components integrating with @tanstack/react-form for structured, accessible forms.
apps/app/src/routes/_layout/create/feed.tsx, apps/app/src/routes/_layout/create/feed/index.tsx, apps/app/src/routes/_layout/create/feed/settings.tsx, apps/app/src/routes/_layout/create/feed/review.tsx, apps/app/src/routeTree.gen.ts Refactored and modularized the frontend feed creation process into step-based routes with progress UI, form-driven state, and review/submit logic.
apps/app/src/lib/api/feeds.ts Updated hooks to use new API request/response types, added moderation permission check hook, improved type safety.
apps/app/package.json, apps/app/rsbuild.config.ts Updated and added dependencies, changed plugin imports, enabled route generation, and added source alias.
packages/shared-db/package.json, packages/shared-db/tsconfig.json Added dependency on shared types and enabled project references.
apps/app/src/components/FeedItem.tsx, apps/app/src/components/FeedList.tsx Minor import path and logging changes.
apps/app/src/components/CurationFormSteps.tsx, apps/app/src/components/CurationSettingsForm.tsx, apps/app/src/lib/api/feed.ts Removed obsolete components and hooks, replaced by new modular route-based flow.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend (Multi-step Feed Creation)
    participant API (feeds.ts)
    participant FeedService
    participant FeedRepository
    participant Database

    User->>Frontend (Multi-step Feed Creation): Fill out step forms (info, settings, review)
    Frontend (Multi-step Feed Creation)->>API (feeds.ts): POST /feeds (validated with Zod)
    API (feeds.ts)->>FeedService: createFeed(feedConfig, accountId)
    FeedService->>FeedRepository: createFeed({config, created_by, ...})
    FeedRepository->>Database: Insert feed record
    Database-->>FeedRepository: Feed record
    FeedRepository-->>FeedService: Feed record
    FeedService-->>API (feeds.ts): Feed record
    API (feeds.ts)-->>Frontend (Multi-step Feed Creation): JSON response (validated)
    Frontend (Multi-step Feed Creation)-->>User: Show success, navigate to feed
Loading

Possibly related PRs

  • PotLock/curatedotfun#156: Also refactors feed API routes and repository methods, focusing on async DB calls, validation, and error handling—directly overlaps with this PR in feed CRUD logic and error handling.
  • PotLock/curatedotfun#169: Introduces the ModerationService and updates feed and submission services to use it, closely related to this PR's moderation and service integration refactor.

Poem

In the garden of code where the feeds now grow,
Rabbits refactored with Zod’s gentle flow.
Errors are tamed, responses precise,
Forms hop in steps—oh, isn’t that nice?
With schemas and types, the backend’s in tune,
The feed creation journey now ends none too soon!
🥕✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@elliotBraem
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jun 21, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🔭 Outside diff range comments (1)
apps/app/src/lib/api/feeds.ts (1)

44-68: Consider adding query invalidation on successful mutations.

The mutation hooks should invalidate related queries to ensure data consistency.

export function useCreateFeed() {
+ const queryClient = useQueryClient();
  return useApiMutation<FeedResponse, Error, CreateFeedRequest>(
    {
      method: "POST",
      path: `/feeds`,
      message: "createFeed",
    },
    {
-     // onSuccess logic can be added here if needed, using queryClient from useQueryClient()
+     onSuccess: () => {
+       queryClient.invalidateQueries({ queryKey: ["feeds"] });
+     },
    },
  );
}

export function useUpdateFeed(feedId: string) {
+ const queryClient = useQueryClient();
  return useApiMutation<FeedResponse, Error, UpdateFeedRequest>(
    {
      method: "PUT",
      path: `/feeds/${feedId}`,
      message: "updateFeed",
    },
    {
-     // onSuccess logic
+     onSuccess: () => {
+       queryClient.invalidateQueries({ queryKey: ["feeds"] });
+       queryClient.invalidateQueries({ queryKey: ["feed-details", feedId] });
+     },
    },
  );
}
🧹 Nitpick comments (11)
apps/app/src/components/FeedList.tsx (1)

7-7: Remove Debugging console.log
This console.log appears to be left over from debugging. Please remove it or replace it with a structured logger for production readiness.

apps/app/package.json (1)

43-44: Consider necessity of lodash dependency.

While immer is excellent for immutable state updates, consider whether the full lodash library is necessary or if specific utility functions could be implemented directly to reduce bundle size.

apps/app/src/routes/_layout/create/feed.tsx (1)

37-52: Consider improving step navigation accessibility.

The step titles could be made clickable to allow direct navigation to completed steps, improving user experience.

              <div
                key={index}
                className="flex flex-col items-center min-w-[100px] px-2"
+               role="button"
+               tabIndex={index <= currentStep ? 0 : -1}
              >
apps/app/src/routes/_layout/create/feed/review.tsx (1)

99-102: TODO: Implement user name resolution

The TODO comment indicates missing functionality to display user names alongside handles.

Would you like me to help implement a solution to fetch and display user names from Twitter handles, or should I open an issue to track this enhancement?

apps/app/src/components/PublishIntegrations.tsx (1)

120-127: Incomplete save button implementation

The save button currently only logs to console without any actual save functionality. Since the form state is managed by react-hook-form, consider if this button is necessary or if it should trigger form validation/submission.

Should this button validate and save the Telegram settings, or can it be removed since the form context already manages the state?

apps/app/src/components/ContentApprovers.tsx (1)

174-179: Use camelCase for SVG attributes in React

SVG attributes should use camelCase in React components.

Apply this diff:

                   <path
                     d="M3 6.5H21M19 6.5V20.5C19 21.5 18 22.5 17 22.5H7C6 22.5 5 21.5 5 20.5V6.5M8 6.5V4.5C8 3.5 9 2.5 10 2.5H14C15 2.5 16 3.5 16 4.5V6.5M10 11.5V17.5M14 11.5V17.5"
                     stroke="#020617"
-                    stroke-linecap="round"
-                    stroke-linejoin="round"
+                    strokeLinecap="round"
+                    strokeLinejoin="round"
                   />
apps/api/src/routes/api/feeds.ts (3)

173-175: Remove redundant null check

The null check for updatedFeed appears redundant. The feedService.updateFeed method should throw appropriate errors (NotFoundError or ForbiddenError) rather than returning null, maintaining consistent error handling patterns across the service layer.


283-283: Consider using validated response schema

This endpoint returns an unvalidated object while all other endpoints use validated response schemas. Consider creating a schema for the moderation permission response to maintain consistency.

Define a response schema:

const CanModerateResponseSchema = z.object({
  canModerate: z.boolean(),
  reason: z.string().optional(),
  error: z.string().optional(),
});

Also applies to: 297-297


288-291: Inconsistent service retrieval pattern

This route uses a different pattern for service retrieval with generic type parameter while other routes use direct methods. Consider using ServiceProvider.getInstance().getModerationService() for consistency.

-      const moderationService =
-        ServiceProvider.getInstance().getService<ModerationService>(
-          "moderationService",
-        );
+      const moderationService = ServiceProvider.getInstance().getModerationService();
apps/app/src/store/feed-creation-store.ts (2)

57-60: Consider making the AI prompt configurable.

The AI transform prompt is hardcoded in the initial state. Consider moving this to a configuration constant or making it customizable, as different feeds might need different summarization approaches.

Would you like me to suggest a pattern for making the AI prompt configurable while maintaining sensible defaults?


86-90: Consider type-safe path updates.

The setValue method accepts a string path which isn't type-safe. Consider using a type-safe approach like ts-toolbelt's Path type or creating specific update methods for commonly updated paths.

-  setValue: (path: string, value: unknown) => void;
+  setValue: <T extends keyof FeedConfig>(path: T | `${T}.${string}`, value: unknown) => void;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccc02ec and 63598b2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (28)
  • apps/api/src/routes/api/feeds.ts (2 hunks)
  • apps/api/src/services/feed.service.ts (6 hunks)
  • apps/api/src/types/errors.ts (1 hunks)
  • apps/app/package.json (2 hunks)
  • apps/app/rsbuild.config.ts (3 hunks)
  • apps/app/src/components/ContentApprovers.tsx (2 hunks)
  • apps/app/src/components/CurationFormSteps.tsx (0 hunks)
  • apps/app/src/components/CurationSettingsForm.tsx (0 hunks)
  • apps/app/src/components/FeedItem.tsx (1 hunks)
  • apps/app/src/components/FeedList.tsx (1 hunks)
  • apps/app/src/components/PublishIntegrations.tsx (3 hunks)
  • apps/app/src/components/ui/tanstack-form.tsx (1 hunks)
  • apps/app/src/lib/api/feed.ts (0 hunks)
  • apps/app/src/lib/api/feeds.ts (4 hunks)
  • apps/app/src/routeTree.gen.ts (14 hunks)
  • apps/app/src/routes/_layout/create/feed.tsx (1 hunks)
  • apps/app/src/routes/_layout/create/feed/index.tsx (1 hunks)
  • apps/app/src/routes/_layout/create/feed/review.tsx (5 hunks)
  • apps/app/src/routes/_layout/create/feed/settings.tsx (1 hunks)
  • apps/app/src/store/feed-creation-store.ts (1 hunks)
  • packages/shared-db/package.json (1 hunks)
  • packages/shared-db/src/repositories/feed.repository.ts (4 hunks)
  • packages/shared-db/src/schema/feeds.ts (3 hunks)
  • packages/shared-db/src/validators.ts (0 hunks)
  • packages/shared-db/tsconfig.json (1 hunks)
  • packages/types/src/api/feeds.ts (1 hunks)
  • packages/types/src/config.ts (2 hunks)
  • packages/types/src/index.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • apps/app/src/lib/api/feed.ts
  • packages/shared-db/src/validators.ts
  • apps/app/src/components/CurationFormSteps.tsx
  • apps/app/src/components/CurationSettingsForm.tsx
🔇 Additional comments (34)
apps/app/src/components/FeedItem.tsx (1)

7-7: Import path updated to new feeds module
This aligns with the consolidation of your API hooks into feeds.ts.

packages/shared-db/package.json (1)

26-26: Add Workspace Dev Dependency for Shared Types
Introducing @curatedotfun/types as a workspace devDependency ensures shared type definitions are accessible during development.

packages/types/src/index.ts (1)

5-8: Export New Feeds API Types
Adding export * from "./api/feeds" integrates the new feed schemas into the shared types package, enabling consistent typing across the codebase.

apps/app/rsbuild.config.ts (3)

3-3: LGTM: Updated import to match new TanStack Router plugin API.

The change from default import TanStackRouterRspack to named import tanstackRouter aligns with the plugin API update.


27-27: Good addition: "@" alias improves import readability.

Adding the "@" alias pointing to "./src" will make imports cleaner throughout the application.


49-51: LGTM: Plugin configuration updated correctly.

The plugin invocation now uses the correct named import and enables route generation, which is essential for the new multi-step feed creation flow.

apps/app/package.json (2)

32-35: LGTM: Form handling dependencies added.

The addition of @tanstack/react-form and @tanstack/zod-form-adapter supports the new form-driven approach in the multi-step feed creation flow.


34-34: LGTM: Router packages updated consistently.

The router packages are updated to caret versions, which aligns with the routing refactor and ensures compatibility.

Also applies to: 67-67

packages/types/src/config.ts (3)

79-79: LGTM: Image field change improves UI flexibility.

Allowing empty string in addition to URL for the image field provides better flexibility for forms where users might not provide an image initially.


81-81: LGTM: Admins field addition expands functionality.

The optional admins array field enhances feed configuration capabilities for permission management.


35-38: ```shell
#!/bin/bash

Show the declaration and nearby context of RecapConfigSchema

rg -n "RecapConfigSchema" -C 5 packages/types/src/config.ts

Search for any usage of RecapConfig or RecapConfigSchema across .ts and .tsx files

rg -n "RecapConfig(Schema)?\b" -g "*.{ts,tsx}" -C 5


</details>
<details>
<summary>apps/app/src/routes/_layout/create/feed/settings.tsx (1)</summary>

`58-63`: **LGTM: Proper form setup with global state.**

The form is correctly initialized with default values from the global feed creation store and uses the FormProvider pattern for child components.

</details>
<details>
<summary>apps/app/src/routes/_layout/create/feed.tsx (2)</summary>

`12-22`: **LGTM: Well-implemented step tracking logic.**

The step matching logic correctly identifies the current step using `useMatchRoute` and calculates progress percentage appropriately.

---

`31-57`: **LGTM: Good responsive design and user experience.**

The layout provides clear visual feedback with step indicators, progress bar, and responsive design considerations. The use of `Outlet` properly renders nested route content.

</details>
<details>
<summary>apps/app/src/routes/_layout/create/feed/review.tsx (1)</summary>

`22-23`: ```shell
#!/bin/bash
# Inspect the create feed API hook
echo "===== apps/app/src/lib/api/feeds.ts ====="
sed -n '1,200p' apps/app/src/lib/api/feeds.ts

# Inspect the feed creation store definition
echo "===== apps/app/src/store/feed-creation-store.ts ====="
sed -n '1,200p' apps/app/src/store/feed-creation-store.ts
packages/types/src/api/feeds.ts (1)

1-60: Well-structured type definitions

The Zod schemas are properly organized with clear documentation and appropriate type exports. The date preprocessing ensures consistent serialization.

packages/shared-db/src/schema/feeds.ts (1)

102-116: Well-structured schema generation!

Great use of drizzle-zod for automatic schema generation from the table definition. This approach reduces duplication and ensures consistency between database schema and validation schemas.

packages/shared-db/src/repositories/feed.repository.ts (1)

110-132: Excellent cascading delete implementation!

The explicit deletion of related records before deleting the main feed record is a robust approach that prevents foreign key constraint violations. Returning the deleted record is also useful for audit trails and confirmation.

apps/app/src/components/ui/tanstack-form.tsx (1)

92-109: Excellent accessibility implementation!

Great use of ARIA attributes (aria-describedby, aria-invalid) to ensure screen readers properly announce form field states and associated messages.

apps/app/src/store/feed-creation-store.ts (4)

1-7: LGTM! Good choice of utilities for state management.

Using Immer middleware with Zustand is an excellent choice for managing complex nested state immutably. The lodash utilities are appropriate for the nested object operations.


8-25: Well-structured type definitions.

The type definitions are clear and appropriately typed. Using Partial<FeedConfig> for the feedConfig state is a good choice for building the configuration incrementally during the creation flow.


96-123: Excellent implementation of Telegram config management.

The setTelegramConfig method correctly handles all scenarios: adding new config, updating existing config, and removing when disabled. Good use of array manipulation methods.


124-137: Well-implemented approver synchronization.

The setApprovers method correctly maintains consistency between the flat approvers array and the nested moderation.approvers object grouped by platform. The use of lodash's groupBy and reduce pattern is appropriate.

apps/api/src/services/feed.service.ts (3)

90-102: Clean implementation of feed creation.

Good separation of concerns by accepting FeedConfig and internally constructing the database insert object. Proper use of transactions.


104-110: Proper error handling for missing resources.

Good use of the NotFoundError with clear resource identification. This provides consistent error responses across the API.


162-177: Well-implemented feed deletion with proper authorization.

Good permission checks and error handling. The method properly returns the deleted feed data which can be useful for audit trails or undo functionality.

apps/app/src/lib/api/feeds.ts (2)

23-42: Clean implementation of data unwrapping.

Good use of the select option to unwrap the response data. The type transformations are clear and the fallback to empty array in useAllFeeds is a good defensive practice.


135-141: Verify the response type matches the API.

The TODO comment indicates uncertainty about the response type matching the API. This should be verified to ensure type safety.

#!/bin/bash
# Search for the can-moderate endpoint definition in the API
ast-grep --pattern 'router.$_("/feeds/:feedId/can-moderate"' 

# Also search for any response type definitions
rg -A 10 "can-moderate" --glob "*.ts" --glob "!node_modules"
apps/api/src/types/errors.ts (2)

3-61: Well-designed error class hierarchy.

The simplified error hierarchy is clean and follows REST conventions. Good design choices:

  • Fixed status codes for standard errors
  • Optional details for additional context
  • Service-specific errors with flexible status codes
  • Consistent constructor patterns

62-70: Good error response schema definition.

The Zod schema provides runtime validation for error responses and ensures consistent error structure across the API. The success: false literal is useful for discriminating between success and error responses.

apps/app/src/routeTree.gen.ts (4)

90-94: LGTM: Well-structured nested route hierarchy for multi-step flow.

The route definitions correctly establish a parent-child relationship that supports the multi-step feed creation workflow. The nested structure allows for clean navigation between form steps while maintaining shared layout and state.

Also applies to: 127-137


454-468: LGTM: Consistent implementation of parent route with children.

The LayoutCreateFeedRouteChildren interface and implementation follows the established pattern used by other parent routes in the application (like LayoutFeedFeedIdRouteChildren). The structure properly defines the relationship between the parent feed creation route and its child steps.


154-168: ```shell
#!/bin/bash
echo "Re-running navigation reference search without --type flags and using globs..."
rg -i "navigate.create/feed" -n --glob '.tsx' --glob '.ts' --glob '.js' --glob '.jsx'
rg -i "href.create/feed" -n --glob '.tsx' --glob '
.ts' --glob '.js' --glob '.jsx'
rg -i "/create/feed" -n --glob '.tsx' --glob '.ts' --glob '.js' --glob '.jsx' -A 2


---

`23-23`: ```shell
#!/bin/bash
echo "Checking for named export 'Route' in new route components..."

grep -R -n "export .*Route" apps/app/src/routes/_layout/create/feed/index.tsx || echo "No 'Route' export found in index.tsx"
grep -R -n "export .*Route" apps/app/src/routes/_layout/create/feed/settings.tsx || echo "No 'Route' export found in settings.tsx"
grep -R -n "export .*Route" apps/app/src/routes/_layout/create/feed/review.tsx || echo "No 'Route' export found in review.tsx"

@@ -256,8 +297,8 @@ feedsRoutes.get(
return c.json({ canModerate });
} catch (error: any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use unknown instead of any for error type

-    } catch (error: any) {
+    } catch (error: unknown) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error: any) {
} catch (error: unknown) {
🤖 Prompt for AI Agents
In apps/api/src/routes/api/feeds.ts at line 298, the catch block currently types
the error as 'any', which is not recommended. Change the error type from 'any'
to 'unknown' to improve type safety and better handle unexpected error types.

Comment on lines 192 to 195
const feedConfig = (await this.feedRepository.getFeedConfig(
feedId,
)) as FeedConfig; // Get config from DB
if (!feedConfig) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid type assertion for feed config.

The type assertion as FeedConfig could hide type mismatches. Consider validating the config structure or updating the repository method to return the correct type.

-    const feedConfig = (await this.feedRepository.getFeedConfig(
-      feedId,
-    )) as FeedConfig; // Get config from DB
+    const feedConfig = await this.feedRepository.getFeedConfig(feedId);
+    if (!feedConfig || !this.isValidFeedConfig(feedConfig)) {
+      throw new Error(`Invalid feed configuration for feedId: ${feedId}`);
+    }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In apps/api/src/services/feed.service.ts around lines 192 to 195, avoid using
the type assertion 'as FeedConfig' when retrieving the feedConfig from the
repository, as it can mask type mismatches. Instead, update the
feedRepository.getFeedConfig method to explicitly return a Promise of FeedConfig
or validate the returned data structure before assignment to ensure type safety
without forced casting.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem and others added 2 commits June 20, 2025 23:20
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@elliotBraem elliotBraem merged commit d38e1cc into staging Jun 21, 2025
3 of 4 checks passed
@elliotBraem elliotBraem deleted the feat/better-feed-form branch June 21, 2025 17:52
elliotBraem added a commit that referenced this pull request Jun 21, 2025
* moderation handle platform_user_id and near account id

* standardize activity

* fmt

* delete tests

* fix shared types

* activity leaderboard

* throw not error

* fix services

* feat: use tanstack table for leaderboard (#183)

* fix: mobile layout improvement feed page (#185)

* Refactors create feed flow, steps use router (#188)

* wip

* feed types

* better feed form

* Update packages/shared-db/tsconfig.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/settings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/index.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set lock

* nitpicks

* fmt

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Implements JWT auth flow with 7 day tokens (#187)

* better auth services

* nit picks

* nonce validation

* nitpicks

* clean up

* fix error types

* import error

* fix auth requests

* fix: toast colors not correct (#189)

* fix: toast colors not corrent

* fmt

* fix feed

* fix zod type

* fix @ and config

* fmt

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem added a commit that referenced this pull request Jun 23, 2025
* moderation handle platform_user_id and near account id

* standardize activity

* fmt

* delete tests

* fix shared types

* activity leaderboard

* throw not error

* fix services

* feat: use tanstack table for leaderboard (#183)

* fix: mobile layout improvement feed page (#185)

* Refactors create feed flow, steps use router (#188)

* wip

* feed types

* better feed form

* Update packages/shared-db/tsconfig.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/settings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/index.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set lock

* nitpicks

* fmt

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Implements JWT auth flow with 7 day tokens (#187)

* better auth services

* nit picks

* nonce validation

* nitpicks

* clean up

* fix error types

* import error

* fix auth requests

* fix: toast colors not correct (#189)

* fix: toast colors not corrent

* fmt

* fix feed

* fix zod type

* fix @ and config

* fmt

* feat: add settings page UI

* feat: add route based tab navigation

* feat: welcome route for new feed (#192)

* feat: welcome route for new feed

* fix: feed overflow in top feeds column of leaderboard

* fix: coderabbit comments

* moderate submissions

* fmt

* fmt

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
elliotBraem added a commit that referenced this pull request Jun 24, 2025
* moderation handle platform_user_id and near account id

* standardize activity

* fmt

* delete tests

* fix shared types

* activity leaderboard

* throw not error

* fix services

* feat: use tanstack table for leaderboard (#183)

* fix: mobile layout improvement feed page (#185)

* Refactors create feed flow, steps use router (#188)

* wip

* feed types

* better feed form

* Update packages/shared-db/tsconfig.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/settings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update apps/app/src/routes/_layout/create/feed/index.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* set lock

* nitpicks

* fmt

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Implements JWT auth flow with 7 day tokens (#187)

* better auth services

* nit picks

* nonce validation

* nitpicks

* clean up

* fix error types

* import error

* fix auth requests

* fix: toast colors not correct (#189)

* fix: toast colors not corrent

* fmt

* fix feed

* fix zod type

* fix @ and config

* fmt

* feat: add settings page UI

* feat: add route based tab navigation

* feat: welcome route for new feed (#192)

* feat: welcome route for new feed

* fix: feed overflow in top feeds column of leaderboard

* fix: coderabbit comments

* moderate submissions

* fmt

* fmt

* adds auto approval

* auto approval

* upgrade fastintear

* fix auth flow

* upgrade packages

* nitpicks

* Introduces worker service w/ queues, enables auto-approval (#196)

* init

* clean up

* fmt

* build fixes

* init

* running

* working auto approval

* init

* clean up

* fmt

* build fixes

* init

* running

* working auto approval

* clean up

* nitpicks

* update pnpm lock

* add @roamhq/wrtc

* docker and type module

* agent-twitter-client

* add rspack

* REDIS_URL

* bullmq workaround

* clean config

* fix auth flow

* same flow

* logger

* better logger

* railway logger

---------

Co-authored-by: Zeeshan Ahmad <itexpert120@outlook.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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