Project: workspace-doctolib · Branch: HEAD · Mode: ` · **Model:**claude-opus-4-7`
Stats: 1 user messages, 4 tool calls, tools used: Read.
Conversation
Turn 1 — User
Re-review the following files after recent fixes for FHIR-2219 (multi-select Document Category filter). The previous review flagged: (1) exhaustive-deps on ref-sync useEffect, (2) no disabled guard on onChange, (3) unused ctx param undocumented. Check whether those are resolved and flag any new issues.
Files to read:
1. /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.tsx
2. /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.hooks.ts
3. /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/business/factories/filters/createNhrDocumentCategoryFilterConfig.tsx
4. /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.test.tsx
Report only NEW or still-open actionable issues. Skip previously flagged issues that are out of scope (native HTML DS deviation, aria-haspopup, arrow-key nav). Be concise.
Turn 1 — Assistant
I'll review the four files to check whether the previously flagged issues are resolved and identify any new issues.
Tools used:
Read:/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.tsx
Tool results:
→ result (ok): 1 import { ChevronDownRegularIcon } from '@doctolib/design-system-icons/ChevronDownRegularIcon'
2 import { Checkbox } from '@doctolib/design-system/Checkbox/v2'
3 import { IconButton } from '@doctolib/design-system/IconButton/v2'
4 import type { Option } from '@doctolib/design-system/Option'
5 import { useId, useMemo, useRef, useState } from 'react'
6
7 import { normalize } from './NhrDocumentCategoryFilter.helpers'
8 import { useDropdownClose } from './NhrDocumentCategoryFilter.hooks'
9
10 ty
…(truncated, 4121 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.hooks.ts
Tool results:
→ result (ok): 1 import { type RefObject, useEffect, useRef } from 'react'
2
3 export const useDropdownClose = (
4 containerRef: RefObject<HTMLDivElement | null>,
5 onClose: () => void,
6 isOpen: boolean
7 ) => {
8 const onCloseRef = useRef(onClose)
9 // Sync ref so the stable event listeners always call the latest onClose.
10 useEffect(() => {
11 onCloseRef.current = onClose
12 }, [onClose])
13
14 useEffect(() => {
15 if (!isOpen) return undefined
16
17 const handlePointerDown =
…(truncated, 625 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/business/factories/filters/createNhrDocumentCategoryFilterConfig.tsx
Tool results:
→ result (ok): 1 import type { Option } from '@doctolib/design-system/Option'
2
3 import { NhrDocumentCategoryFilter } from '../../../components/NhrDocumentList/NhrDocumentCategoryFilter'
4 import type { FilterConfig } from '../../../types'
5
6 export const createNhrDocumentCategoryFilterConfig = ({
7 options = [],
8 label = 'Document Category',
9 placeholder,
10 }: {
11 options?: Option[]
12 label?: string
13 placeholder?: string
14 } = {}): FilterConfig => ({
15 key: 'typeCodes',
16 // ctx
…(truncated, 726 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.test.tsx
Tool results:
→ result (ok): 1 import { setup } from '@doctolib/test-helpers'
2 import { screen } from '@testing-library/react'
3 import { afterEach, describe, expect, it, vi } from 'vitest'
4
5 import { NhrDocumentCategoryFilter } from './NhrDocumentCategoryFilter'
6
7 const sampleOptions = [
8 { value: 'A', label: 'Report A' },
9 { value: 'B', label: 'Report B' },
10 { value: 'C', label: 'Report C' },
11 ]
12
13 describe('NhrDocumentCategoryFilter', () => {
14 afterEach(() => {
15 vi.clearAllMocks()
16
…(truncated, 15740 more chars)
Reviewing the four files for FHIR-2219 follow-up.
Files reviewed
/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.tsx/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.hooks.ts/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/business/factories/filters/createNhrDocumentCategoryFilterConfig.tsx/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter.test.tsx
Status of previously flagged issues
- exhaustive-deps on ref-sync useEffect — RESOLVED.
NhrDocumentCategoryFilter.hooks.ts:10-12syncsonCloseRef.currentwith[onClose]deps; the second effect intentionally depends only on[containerRef, isOpen]and reads the latest callback through the ref. Pattern is correct. - No disabled guard on onChange — RESOLVED.
NhrDocumentCategoryFilter.tsx:115-117guards withif (!option.disabled) onToggle(option.value), plusisDisabled={option.disabled ?? false}is set, and tests at lines 285-306 cover both. - Unused
ctxparam undocumented — RESOLVED.createNhrDocumentCategoryFilterConfig.tsx:16carries the explanatory comment// ctx is required by FilterConfig.render but unused by this filter, and the render signature(filters, onChange)simply omits the unused trailing arg, which is clean.
New / still-open issues
No new issues at confidence ≥ 80.
A couple of low-confidence observations (below the reporting threshold, mentioned only for completeness — not actionable per the rubric):
- The
aria-controlsattribute is conditionally omitted when closed (line 76). Some ARIA references recommend always pointing to the popup id; current behavior is intentional and tested (lines 308-320), so out of scope per your instructions. displayLabelrecomputes when eitheroptionsorvalueschanges; this is fine. No memoization concern.- The test file is 386 lines, under the 400-line warning threshold from
testing/devex.md.
The fixes for the three previously flagged issues are correctly applied, the useDropdownClose hook follows the standard "stable listeners + ref-synced callback" pattern, the disabled-option contract is enforced and covered by tests, and the unused ctx parameter is documented inline. Code meets standards.