Skip to content

[Repo Assist] fix(web): remove debug console.log and add FeatureFlagsModal error stateΒ #497

@github-actions

Description

@github-actions

πŸ€– This PR was created by Repo Assist, an automated AI assistant.

Summary

Two small but clear improvements to the React frontend:

1. Remove debug console.log statements (Task 5 β€” Coding Improvements)

Three console.log calls were left in production code:

File Line Statement
CarCard.tsx ~13 console.log(\Toggling ownership for car ${car.year}`)`
Home.tsx ~56 console.log(\Loaded ${winnersData.length} winners`)`
Home.tsx ~75 console.log(\Updated ownership for ${updatedCar.year} ${updatedCar.model}`)`

These log to the browser console on every user interaction and successful API response β€” noisy and unhelpful in production. All three are removed. The existing console.error calls for genuine error cases are kept.

2. Add error state to FeatureFlagsModal (Task 3 β€” Bug Fix)

Before: When the /flags/{userId} API call failed (network error or non-OK response), the catch block only logged to the console and set loading: false. Because flags remained an empty object, the modal showed "No flags available" β€” misleading users into thinking there are no flags, rather than that a load error occurred.

After: A fetchError state is added. On failure the modal shows "Failed to load flags. Please try again." The error resets to null at the start of each fetchFlags call, so retrying (e.g., re-opening the modal) shows fresh state. The .error CSS class is already defined globally in index.css.


Test Status

  • βœ… npm run build β€” succeeded (TypeScript compile + Vite production build, 0 errors)
  • βœ… npm run lint β€” passed (ESLint, 0 warnings, 0 errors)
  • No existing automated test suite for the React frontend

Generated by Repo Assist Β· β—·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/improve-react-cleanup-console-logs-error-state-a11f4ed64e7e51b0.

Click here to create the pull request

To fix the permissions issue, go to Settings β†’ Actions β†’ General and enable Allow GitHub Actions to create and approve pull requests.

Show patch preview (96 of 96 lines)
From 2200856945c7fdf389d76dc160eb3d27cd2f4717 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 11 Mar 2026 19:16:26 +0000
Subject: [PATCH] fix(web): remove debug console.log and add FeatureFlagsModal
 error state

- CarCard: remove debug console.log in toggleOwnership handler
- Home: remove debug console.log on winners load success and ownership update
- FeatureFlagsModal: add fetchError state so users see an error message
  instead of misleading 'No flags available' when the flags API call fails

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 src/Garage.Web/src/components/CarCard.tsx           | 1 -
 src/Garage.Web/src/components/FeatureFlagsModal.tsx | 8 ++++++++
 src/Garage.Web/src/components/Home.tsx              | 2 --
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Garage.Web/src/components/CarCard.tsx b/src/Garage.Web/src/components/CarCard.tsx
index 758ab76..4a5943d 100644
--- a/src/Garage.Web/src/components/CarCard.tsx
+++ b/src/Garage.Web/src/components/CarCard.tsx
@@ -10,7 +10,6 @@ const CarCard: React.FC<CarCardProps> = ({ car, onOwnershipChanged }) => {
   const toggleOwnership = (event: React.ChangeEvent<HTMLInputElement>) => {
     const updatedCar = { ...car, isOwned: event.target.checked };
     onOwnershipChanged(updatedCar);
-    console.log(`Toggling ownership for car ${car.year}`);
   };
 
   return (
diff --git a/src/Garage.Web/src/components/FeatureFlagsModal.tsx b/src/Garage.Web/src/components/FeatureFlagsModal.tsx
index 558c72c..9f56857 100644
--- a/src/Garage.Web/src/components/FeatureFlagsModal.tsx
+++ b/src/Garage.Web/src/components/FeatureFlagsModal.tsx
@@ -16,6 +16,7 @@ type FlagsMap = Record<string, FlagState>;
 const FeatureFlagsModal = ({ isOpen, onClose }: FeatureFlagsModalProps) => {
   const [flags, setFlags] = useState<FlagsMap>({});
   const [loading, setLoading] = useState(true);
+  const [fetchError, setFetchError] = us
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions