Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useCallback, useEffect, useRef } from "react";
import { useAppStore, Feature } from "@/store/app-store";
import { useAppStore, type Feature } from "@/store/app-store";
import { getElectronAPI } from "@/lib/electron";
import { toast } from "sonner";

Expand Down Expand Up @@ -60,14 +60,15 @@ export function useBoardFeatures({ currentProject }: UseBoardFeaturesProps) {

if (result.success && result.features) {
const featuresWithIds = result.features.map(
(f: any, index: number) => ({
(f: Feature, index: number) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While I appreciate the move towards stronger types by changing f: any to f: Feature, it introduces a slight logical inconsistency. The Feature type defines steps as a required string[], but the new logic steps: f.steps || [] correctly assumes steps might be missing on legacy feature objects. To be more explicit about this data transformation from a potentially incomplete object to a valid Feature object, it would be more accurate to type f as any or a partial type.

Suggested change
(f: Feature, index: number) => ({
(f: any, index: number) => ({

...f,
id: f.id || `feature-${index}-${Date.now()}`,
status: f.status || "backlog",
startedAt: f.startedAt, // Preserve startedAt timestamp
// Ensure model and thinkingLevel are set for backward compatibility
model: f.model || "opus",
thinkingLevel: f.thinkingLevel || "none",
steps: f.steps || []
})
);
// Successfully loaded features - now safe to set them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export function TestingTabContent({
const checkboxId = testIdPrefix ? `${testIdPrefix}-skip-tests` : "skip-tests";

const handleStepChange = (index: number, value: string) => {
const newSteps = [...steps];
const newSteps = [...(steps || [])];
newSteps[index] = value;
onStepsChange(newSteps);
};

const handleAddStep = () => {
onStepsChange([...steps, ""]);
onStepsChange([...(steps || []), ""]);
};

return (
Expand Down Expand Up @@ -60,7 +60,7 @@ export function TestingTabContent({
<p className="text-xs text-muted-foreground mb-2">
Add manual steps to verify this feature works correctly.
</p>
{steps.map((step, index) => (
{Array.isArray(steps) && steps.map((step, index) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the other defensive checks in this file (which use || []), you could use (steps || []).map(...) here as well. It's slightly more concise and achieves the same goal.

Suggested change
{Array.isArray(steps) && steps.map((step, index) => (
{(steps || []).map((step, index) => (

<Input
key={index}
value={step}
Expand Down
Loading