Skip to content

Commit 5b2a0ae

Browse files
committed
bug:fix the reset button disabling
1 parent c93f0f1 commit 5b2a0ae

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/components/directions/directions.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ export const DirectionsControl = () => {
129129
onClick={handleRemoveWaypoints}
130130
data-testid="reset-waypoints-button"
131131
className="w-full shrink"
132-
disabled={waypoints.every((wp) => !wp.userInput)}
132+
disabled={
133+
waypoints.every((wp) => !wp.userInput) && waypoints.length <= 2
134+
}
133135
>
134136
<MapPinXInside className="size-5" />
135137
Reset Waypoints

src/components/directions/waypoints/waypoint-item.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ export const Waypoint = ({ id, index }: WaypointProps) => {
113113
refetchDirections();
114114
}}
115115
data-testid="remove-waypoint-button"
116-
disabled={waypoints.every((wp) => !wp.userInput)}
116+
disabled={
117+
waypoints.every((wp) => !wp.userInput) &&
118+
waypoints.length <= 2
119+
}
117120
>
118121
<Trash className="size-3" />
119122
</Button>

0 commit comments

Comments
 (0)