Skip to content

Add feedback category resetting#484

Merged
tudddorrr merged 1 commit intodevelopfrom
reset-feedback
Mar 1, 2026
Merged

Add feedback category resetting#484
tudddorrr merged 1 commit intodevelopfrom
reset-feedback

Conversation

@tudddorrr
Copy link
Collaborator

No description provided.

@tudddorrr tudddorrr added the enhancement New feature or request label Mar 1, 2026
@claude
Copy link

claude bot commented Mar 1, 2026

PR Review: Add feedback category resetting


🟡 Code Quality

Non-null assertion on nullable prop (ResetFeedbackCategory.tsx)

The prop type declares editingCategory: GameFeedbackCategory | null, but the reset handler uses a non-null assertion:

const res = await resetFeedbackCategory(activeGame.id, editingCategory\!.id, resetMode)

Since the component is only rendered when a category is selected, the assertion holds in practice — but the type should reflect that invariant. Either tighten the prop type to GameFeedbackCategory (non-nullable), or add an early return guard:

// Option A: tighten the type
editingCategory: GameFeedbackCategory

// Option B: guard at the call site
if (\!editingCategory) return
const res = await resetFeedbackCategory(activeGame.id, editingCategory.id, resetMode)

🔵 Minor

Duplicated default reset mode (ResetFeedbackCategory.tsx)

The default mode 'dev' is hardcoded independently in two places:

const [resetMode, setResetMode] = useState<ResetMode>('dev')
...
defaultValue={resetModeOptions.find((option) => option.value === 'dev')}

If the default ever changes, both must be updated in sync. A single constant eliminates the duplication:

const DEFAULT_RESET_MODE: ResetMode = 'dev'
const [resetMode, setResetMode] = useState(DEFAULT_RESET_MODE)
...
defaultValue={resetModeOptions.find((option) => option.value === DEFAULT_RESET_MODE)}

Inverted callback naming (ResetFeedbackCategory.tsx)

The modalState prop callback is typed as (goBack: boolean) => void, but goBack(true) means "do not go back" and goBack(false) means "do go back". The parent names its parameter close, which is closer to the intent but still inverted from the child's perspective. A clearer name like fullyClose or flipping the semantics (goBack(false) = stay, goBack(true) = go back) would reduce confusion for future readers.

@tudddorrr tudddorrr merged commit 12d40f5 into develop Mar 1, 2026
5 checks passed
@tudddorrr tudddorrr deleted the reset-feedback branch March 1, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant