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

add: auto focus to rating input #126

Open
wants to merge 1 commit into
base: prototype
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/rate/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default function Form({ name = "", owner = "" }) {
value={owner && name && `https://github.com/${owner}/${name}`}
placeholder="URL"
className="block w-full rounded-md border-0 bg-white/5 py-1.5 text-white shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-indigo-500 sm:text-sm sm:leading-6"
autoFocus
required
/>
</div>
Comment on lines 83 to 89
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [13-35]

The save function encapsulates the logic for form submission, including session validation, JWT creation, and the POST request to the /api/rate endpoint. It's crucial to handle errors gracefully, as done here with the catch block that redirects users to an error page if the session is invalid. However, consider adding more detailed error handling for the fetch request itself, such as checking for HTTP status codes that indicate failure (e.g., 4xx, 5xx responses) before assuming data.success or data.error.

if (!res.ok) {
  setSending(false);
  alert("Failed to save rating. Please try again.");
  return;
}

Expand Down