Skip to content
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

fix(mobile): update types and star entry with view #2728

Merged
merged 1 commit into from
Feb 12, 2025
Merged

Conversation

lawvs
Copy link
Member

@lawvs lawvs commented Feb 12, 2025

This pull request includes changes to the context-menu/entry.tsx file to improve the handling of starring and unstarring entries.

Copy link

vercel bot commented Feb 12, 2025

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

Name Status Preview Comments Updated (UTC)
follow ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2025 7:58am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
follow-external-ssr ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2025 7:58am

@follow-reviewer-bot
Copy link

Suggested PR Title:

feat(context-menu): improve star/unstar entry functionality

Change Summary:
Refactor EntryItemContextMenu to streamline star/unstar logic and use selected view state. This enhances readability, reduces redundancy, and improves error handling for starring entries.

Code Review:

Code Review

File: apps/mobile/src/modules/context-menu/entry.tsx

  1. Line 65-68: Error Handling for feedId and view

    • The code adds a validation for entry.feedId and view before starring an entry. However, the implementation only logs an error with console.error() and then returns prematurely.
    • Issue: Silent failure without user feedback. The user should be informed if the action fails.
    • Change Request: Replace console.error() with a user-facing error notification (e.g., toast.error("Failed to star entry due to missing data")) to provide feedback about the failure.
  2. Line 62: collectionSyncService.unstarEntry API Parameter Change

    • The unstarEntry function usage has been modified to only pass the id. However, the previous implementation passed additional data (createdAt).
    • Issue: It is unclear whether the removal of createdAt is intentional or whether it will break functionality. If the API requires this parameter, omitting it may cause runtime errors or incomplete state updates.
    • Change Request: Verify with the API interface whether omitting createdAt is valid. If required, ensure createdAt is sent as part of the parameters.
  3. General: Exception Management in Async Calls

    • Although the code involves potentially asynchronous operations with collectionSyncService calls, there is no explicit error handling for these calls.
    • Issue: Lack of error-handling mechanisms for API calls leaves the code vulnerable to unhandled exceptions or unexpected failures.
    • Change Request: Wrap the collectionSyncService calls in a try-catch block or handle errors using .catch() to ensure robust exception management and provide feedback to the user if an action fails.

Summary

The above changes are necessary to ensure proper error handling and verification of API contract changes:

  1. Replace silent console.error() with user-facing error feedback.
  2. Verify the unstarEntry API contract for omitted parameters, specifically createdAt.
  3. Add error-handling mechanisms for collectionSyncService API calls.

Please address these issues to improve the robustness and user experience of the code.

@lawvs lawvs merged commit dea3380 into dev Feb 12, 2025
10 checks passed
@lawvs lawvs deleted the fix/star-entry branch February 12, 2025 08:17
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