Skip to content

feat: redirect to the feed page after creation #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025
Merged

Conversation

0x2E
Copy link
Owner

@0x2E 0x2E commented Apr 26, 2025

No description provided.

@0x2E 0x2E requested a review from Copilot April 26, 2025 08:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a redirect to the feed page after feed creation and updates the API responses accordingly. Key changes include the introduction of a new response type for feed creation, modifications to the Create method in the server to return a response instead of a void value, and corresponding updates on the frontend and API endpoint to handle the new response.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
server/feed_form.go Added a new "RespFeedCreate" type to encapsulate feed IDs in the JSON response.
server/feed.go Modified the Create method to return a response and adjusted the asynchronous processing logic.
frontend/src/lib/api/feed.ts Updated the API call to parse the JSON response containing the feed IDs.
api/feed.go Changed the API endpoint to return a JSON response with the created feed details.
Files not reviewed (1)
  • frontend/src/lib/components/FeedActionImportManually.svelte: Language not supported

}

puller := pull.NewPuller(repo.NewFeed(repo.DB), repo.NewItem(repo.DB))
if len(feeds) >= 1 {
if len(feeds) > 1 {
Copy link
Preview

Copilot AI Apr 26, 2025

Choose a reason for hiding this comment

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

Ensure that the condition for triggering asynchronous processing is intentional. If a single feed creation should be processed synchronously with a pull, confirm that using 'if len(feeds) > 1' is the correct logic for differentiating the two cases.

Copilot uses AI. Check for mistakes.

}
return puller.PullOne(ctx, feeds[0].ID)
return resp, puller.PullOne(ctx, feeds[0].ID)
Copy link
Preview

Copilot AI Apr 26, 2025

Choose a reason for hiding this comment

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

Returning the result of puller.PullOne along with the response may lead to unintended error propagation. Consider handling the error from puller.PullOne separately to ensure a clear separation between a successful creation response and asynchronous processing errors.

Suggested change
return resp, puller.PullOne(ctx, feeds[0].ID)
go func() {
// NOTE: do not use the incoming ctx, as it will be Done() automatically
// by API timeout middleware
puller.PullOne(context.Background(), feeds[0].ID)
}()
return resp, nil

Copilot uses AI. Check for mistakes.

@0x2E 0x2E merged commit e0938da into main Apr 26, 2025
1 check passed
@0x2E 0x2E deleted the feed_creation_redirect branch April 28, 2025 04:32
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