Skip to content

Commit

Permalink
Fix Cursor Jumping When Changing Station Title
Browse files Browse the repository at this point in the history
  • Loading branch information
njfdev committed Jul 23, 2024
1 parent a49b390 commit 2d948ce
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/SavedStationsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ function SavedStationCard({
loadingStation: Station | undefined;
updateRequestedStation: (station?: Station) => void;
}) {
const [newTitle, setNewTitle] = useState(station.title);

const isCurrentStationPlaying =
isStationPlaying &&
currentStation &&
Expand All @@ -179,12 +181,15 @@ function SavedStationCard({
<div className="flex justify-between align-middle items-center gap-4">
<CardTitle>
<Input
value={station.title}
value={newTitle}
className="text-lg"
onChange={(e) => {
setNewTitle(e.target.value || "");
}}
onBlur={() => {
updateStation(station, {
...station,
title: e.target.value || "",
title: newTitle,
});
}}
/>
Expand Down

0 comments on commit 2d948ce

Please sign in to comment.