-
Notifications
You must be signed in to change notification settings - Fork 995
Fix/order item summary #15111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Fix/order item summary #15111
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughReplaced a single request_order-filtered deliveries query with per-delivery-order parallel queries (useQueries); Changes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bb881ef to
2b81824
Compare
🚀 Preview Deployment Ready!
This preview will be automatically updated when you push new commits to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
@src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx:
- Around line 109-122: The current useMemo for allSupplyDeliveries depends on
deliveryQueries, causing recalculations when query metadata changes; change the
dependency to derive and depend on the actual data arrays instead (e.g., create
a queryDataRefs or queryResults array by mapping deliveryQueries to q.data or
q.data?.results and use that in the dependency list) and keep the existing
deduplication logic (flatDeliveries/result/seen) inside the memo; if the linter
flags the inline .map() in the deps, extract the mapped array into a separate
const (e.g., queryDataRefs or queryResults) and reference that in the useMemo
dependencies.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Use declarative JSX
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use raviger for application routing in page components and route definitions
src/pages/**/*.{ts,tsx}: Keep page components insrc/pages/organized by feature
Use descriptive file names that reflect the page purpose
Export page components as default exports
Co-locate page-specific components and utilities with page components
Useravigerrouter for navigation (existing dependency)
Implement proper route parameters and query string handling
Handle navigation guards and authentication checks in page components
Implement proper loading states and error boundaries in page components
Use semantic HTML structure for accessibility in page components
Use@tanstack/react-queryfor API state management in page components (existing dependency)
Implement proper loading, error, and success states for data fetching
Handle pagination and infinite scroll patterns appropriately
Cache data appropriately in page components based on usage patterns
Use controlled components for form inputs in page components
Implement proper form validation withzodschemas in page components
Handle form submission states (loading, success, error) in page components
Use React hooks for local page state
Minimize unnecessary re-renders in page components
Implement proper authentication checks in page components
Handle different user roles and permissions in page components
Redirect to login when authentication is required in page components
Show appropriate UI based on user permissions in page components
Set appropriate page titles and meta descriptions in page components
Handle OpenGraph and Twitter card meta tags in page components
Implement structured data where applicable in page components
Implement code splitting for large page components
Use lazy loading for heavy components within page components
Optimize bundle size with proper imports in page components
Handle image optimization and lazy loading in page components
Implement comprehensive error boundaries in page components
Handle API e...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Tailwind CSS 4.1.3 utility classes with custom healthcare-specific design system for styling
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
**/*.tsx: Use functional components with proper type definitions in React
One component per file is preferred
Prefer default exports for React components
Follow the component naming pattern:ComponentName.tsxfor React components
Use Tailwind CSS for styling
Use Shadcn UI components when available
Use local state for component-specific data
Use PascalCase for component file names (e.g.,AuthWizard.tsx)
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧠 Learnings (17)
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Use `tanstack/react-query` for server state management with facility data and patient records
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-14T14:26:31.165Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14348
File: src/components/Patient/TreatmentSummary.tsx:523-523
Timestamp: 2025-11-14T14:26:31.165Z
Learning: In TreatmentSummary.tsx, medication statements (from medicationStatementApi) only contain SNOMED-coded medications and use `medication.medication.display ?? medication.medication.code` pattern, whereas medication requests (from medicationRequestApi) can have either SNOMED codes or inventory products and should use `displayMedicationName()` helper function to correctly handle both cases.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components with React Query for real-time data from medical API endpoints
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use `tanstack/react-query` for API state management in page components (existing dependency)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-31T22:13:06.153Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10345
File: src/components/Resource/ResourceDetailsUpdate.tsx:132-145
Timestamp: 2025-01-31T22:13:06.153Z
Learning: The migration from useTanStackQueryInstead to useQuery in React components requires:
1. Updating types to use UseQueryResult instead of custom hook return type
2. Replacing loading with isLoading property
3. Using queryKey array for cache management
4. Using queryFn with query utility function
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:09.978Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/02-coding-standards.mdc:0-0
Timestamp: 2025-11-25T13:54:09.978Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for API data management
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components cleanly with healthcare data sources and support live data updates for critical medical information
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query with the `query` and `mutate` utilities from `@/Utils/request/`
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use tanstack/react-query for server state management in API client code
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Use `useState` for local state and `tanstack/react-query` for server state in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Integrate with tanstack/react-query for server state management in providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useMutation` hook with `mutationFn` parameter wrapping API routes with the `mutate()` utility, and implement `onSuccess` callbacks to invalidate related queries
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-03T16:26:08.045Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9708
File: src/components/Users/UserResetPassword.tsx:72-89
Timestamp: 2025-01-03T16:26:08.045Z
Learning: When using react-query’s mutate, avoid chaining the calls as "() => mutate(...)(...)" and just call "mutate(...)" directly, relying on its built-in error handling and the global notification dispatcher.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:20.837Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/typescript-types.instructions.md:0-0
Timestamp: 2025-11-25T13:53:20.837Z
Learning: Applies to src/types/**/*{Query,Result}*.{ts,tsx} : React Query integration types should export query result types with data, isLoading, error, and refetch properties for API operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-17T19:47:58.152Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14821
File: src/components/Location/LocationNavigation.tsx:161-163
Timestamp: 2025-12-17T19:47:58.152Z
Learning: To ensure the remove-unused-i18n.js cleanup script detects i18n keys, avoid wrapping keys inside a ternary expression passed directly to t(). Instead, call t() separately in each branch of a conditional, e.g. condition ? t("key1") : t("key2"), or compute the key in a variable before passing to t(). For LocationNavigation.tsx (and similar TSX files in the repo), prefer explicit separate i18n calls per branch or a shared precomputed key to guarantee all keys are statically detectable by the script.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-22T10:16:36.690Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 14804
File: src/pages/Facility/services/pharmacy/DispensesView.tsx:117-135
Timestamp: 2025-12-22T10:16:36.690Z
Learning: In the care_fe repository, prefer the native HTML title attribute for simple tooltips over using shadcn/ui Tooltip components. Use Tooltip components only when the tooltip requires richer content, interactivity, or accessibility enhancements that cannot be achieved with a plain title. For simple cases, add a title attribute to the element (e.g., <span title="...">). If a Tooltip is used, ensure it is accessible and necessary, and avoid duplicating content available in the title attribute.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧬 Code graph analysis (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (4)
src/types/inventory/productKnowledge/productKnowledge.ts (1)
ProductKnowledgeBase(72-86)src/Utils/request/query.ts (1)
query(87-94)src/types/inventory/supplyDelivery/supplyDelivery.ts (1)
SupplyDeliveryRead(64-72)src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx (1)
SupplyDeliveryTable(56-341)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: deploy-preview
- GitHub Check: Test
- GitHub Check: CodeQL-Build
🔇 Additional comments (6)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (6)
1-6: LGTM!Import additions are appropriate for the new parallel query pattern using
useQueriesand proper typing withSupplyDeliveryRead.
66-80: LGTM!Interface change correctly reflects the new data flow — accepting multiple delivery order IDs enables fetching items from all associated deliveries, not just those linked to the original request.
124-142: LGTM!Rendering logic correctly adapts to the new deduplicated array structure, with proper handling for loading, populated, and empty states.
213-216: LGTM!Memoizing
deliveryOrderIdspreventsAllSupplyDeliveriesComponentfrom unnecessarily re-running all parallel queries when the parent re-renders. This aligns with the PR's optimization objectives.
772-778: Core fix correctly implemented.Passing
deliveryOrderIdsinstead ofrequestOrderIdensures the "Received Items Summary" tab now displays all items from associated delivery orders, including those added after the original request. This addresses the root cause from issue #14955.
252-261: Clarification: This separate query is intentional.This
allSupplyDeliveriesquery (usingrequest_orderfilter) serves a different purpose thanAllSupplyDeliveriesComponent. It's used to calculate dispatched quantities for the "requested-items" tab, where filtering by request order is appropriate for matching against original supply requests. The refactored component addresses only the "items-summary" tab.
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Outdated
Show resolved
Hide resolved
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Outdated
Show resolved
Hide resolved
🎭 Playwright Test ResultsStatus: ❌ Failed
📊 Detailed results are available in the playwright-final-report artifact. Run: #4572 |
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
@src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx:
- Around line 110-122: The memo for allSupplyDeliveries is using deliveryQueries
(which can be a new array reference each render) so memoization is ineffective;
update the dependency to a stable value such as deliveryQueries.map(q =>
q.data?.results) or deliveryQueries.map(q => q.data?.results?.length) (or switch
useQueries to use the combine option) and keep the same dedup logic inside the
allSupplyDeliveries computation so useMemo only reruns when actual query results
change; reference the allSupplyDeliveries constant, the deliveryQueries
variable, and the useMemo call when making the change.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧰 Additional context used
📓 Path-based instructions (13)
public/locale/**/*.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use i18n Locale files with English Locale files in
public/locale/en.json- non-English languages managed via Crowdin only
Files:
public/locale/en.json
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Use declarative JSX
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use raviger for application routing in page components and route definitions
src/pages/**/*.{ts,tsx}: Keep page components insrc/pages/organized by feature
Use descriptive file names that reflect the page purpose
Export page components as default exports
Co-locate page-specific components and utilities with page components
Useravigerrouter for navigation (existing dependency)
Implement proper route parameters and query string handling
Handle navigation guards and authentication checks in page components
Implement proper loading states and error boundaries in page components
Use semantic HTML structure for accessibility in page components
Use@tanstack/react-queryfor API state management in page components (existing dependency)
Implement proper loading, error, and success states for data fetching
Handle pagination and infinite scroll patterns appropriately
Cache data appropriately in page components based on usage patterns
Use controlled components for form inputs in page components
Implement proper form validation withzodschemas in page components
Handle form submission states (loading, success, error) in page components
Use React hooks for local page state
Minimize unnecessary re-renders in page components
Implement proper authentication checks in page components
Handle different user roles and permissions in page components
Redirect to login when authentication is required in page components
Show appropriate UI based on user permissions in page components
Set appropriate page titles and meta descriptions in page components
Handle OpenGraph and Twitter card meta tags in page components
Implement structured data where applicable in page components
Implement code splitting for large page components
Use lazy loading for heavy components within page components
Optimize bundle size with proper imports in page components
Handle image optimization and lazy loading in page components
Implement comprehensive error boundaries in page components
Handle API e...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Tailwind CSS 4.1.3 utility classes with custom healthcare-specific design system for styling
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
**/*.tsx: Use functional components with proper type definitions in React
One component per file is preferred
Prefer default exports for React components
Follow the component naming pattern:ComponentName.tsxfor React components
Use Tailwind CSS for styling
Use Shadcn UI components when available
Use local state for component-specific data
Use PascalCase for component file names (e.g.,AuthWizard.tsx)
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧠 Learnings (28)
📚 Learning: 2025-01-14T09:50:51.248Z
Learnt from: rajku-dev
Repo: ohcnetwork/care_fe PR: 9887
File: src/components/Users/CreateUserForm.tsx:86-92
Timestamp: 2025-01-14T09:50:51.248Z
Learning: When suggesting new validation messages or error strings in code, always ensure corresponding translation keys are added to the locale files (e.g., public/locale/en.json).
Applied to files:
public/locale/en.json
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Use `tanstack/react-query` for server state management with facility data and patient records
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components with React Query for real-time data from medical API endpoints
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-31T22:13:06.153Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10345
File: src/components/Resource/ResourceDetailsUpdate.tsx:132-145
Timestamp: 2025-01-31T22:13:06.153Z
Learning: The migration from useTanStackQueryInstead to useQuery in React components requires:
1. Updating types to use UseQueryResult instead of custom hook return type
2. Replacing loading with isLoading property
3. Using queryKey array for cache management
4. Using queryFn with query utility function
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-14T14:26:31.165Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14348
File: src/components/Patient/TreatmentSummary.tsx:523-523
Timestamp: 2025-11-14T14:26:31.165Z
Learning: In TreatmentSummary.tsx, medication statements (from medicationStatementApi) only contain SNOMED-coded medications and use `medication.medication.display ?? medication.medication.code` pattern, whereas medication requests (from medicationRequestApi) can have either SNOMED codes or inventory products and should use `displayMedicationName()` helper function to correctly handle both cases.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use `tanstack/react-query` for API state management in page components (existing dependency)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:09.978Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/02-coding-standards.mdc:0-0
Timestamp: 2025-11-25T13:54:09.978Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for API data management
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:20.837Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/typescript-types.instructions.md:0-0
Timestamp: 2025-11-25T13:53:20.837Z
Learning: Applies to src/types/**/*{Query,Result}*.{ts,tsx} : React Query integration types should export query result types with data, isLoading, error, and refetch properties for API operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query with the `query` and `mutate` utilities from `@/Utils/request/`
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components cleanly with healthcare data sources and support live data updates for critical medical information
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading, error, and success states for data fetching
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement loading, error, and success states for async operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Implement proper error handling using the global error handler for TanStack Query operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Handle loading, error, and success states consistently across all providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading states and error boundaries in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-08T07:49:59.494Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9748
File: src/pages/Organization/components/OrganizationFilter.tsx:0-0
Timestamp: 2025-01-08T07:49:59.494Z
Learning: The project implements global error handling for React Query errors, making local error handling in individual query hooks unnecessary.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-20T09:11:54.138Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9768
File: src/components/Resource/ResourcePage.tsx:80-89
Timestamp: 2025-01-20T09:11:54.138Z
Learning: In the care_fe project, useQuery and useMutation hooks have global error handlers. Additional error handlers should only be added when specific functionality is needed beyond the global handler. In such cases, prefer using built-in params like isSuccess and isError from useQuery/useMutation.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-02-04T12:39:49.688Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10352
File: src/Providers/AuthUserProvider.tsx:47-63
Timestamp: 2025-02-04T12:39:49.688Z
Learning: The `onError` callback option was removed from `useQuery` in TanStack Query v5. Error handling should be done by checking the `error` state directly or using Error Boundaries.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Handle loading, error, and success states consistently in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement memoization for expensive computations in utility functions
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use tanstack/react-query for server state management in API client code
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Use `useState` for local state and `tanstack/react-query` for server state in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Integrate with tanstack/react-query for server state management in providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useMutation` hook with `mutationFn` parameter wrapping API routes with the `mutate()` utility, and implement `onSuccess` callbacks to invalidate related queries
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-03T16:26:08.045Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9708
File: src/components/Users/UserResetPassword.tsx:72-89
Timestamp: 2025-01-03T16:26:08.045Z
Learning: When using react-query’s mutate, avoid chaining the calls as "() => mutate(...)(...)" and just call "mutate(...)" directly, relying on its built-in error handling and the global notification dispatcher.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-17T19:47:58.152Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14821
File: src/components/Location/LocationNavigation.tsx:161-163
Timestamp: 2025-12-17T19:47:58.152Z
Learning: To ensure the remove-unused-i18n.js cleanup script detects i18n keys, avoid wrapping keys inside a ternary expression passed directly to t(). Instead, call t() separately in each branch of a conditional, e.g. condition ? t("key1") : t("key2"), or compute the key in a variable before passing to t(). For LocationNavigation.tsx (and similar TSX files in the repo), prefer explicit separate i18n calls per branch or a shared precomputed key to guarantee all keys are statically detectable by the script.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-22T10:16:36.690Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 14804
File: src/pages/Facility/services/pharmacy/DispensesView.tsx:117-135
Timestamp: 2025-12-22T10:16:36.690Z
Learning: In the care_fe repository, prefer the native HTML title attribute for simple tooltips over using shadcn/ui Tooltip components. Use Tooltip components only when the tooltip requires richer content, interactivity, or accessibility enhancements that cannot be achieved with a plain title. For simple cases, add a title attribute to the element (e.g., <span title="...">). If a Tooltip is used, ensure it is accessible and necessary, and avoid duplicating content available in the title attribute.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧬 Code graph analysis (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (4)
src/types/inventory/productKnowledge/productKnowledge.ts (1)
ProductKnowledgeBase(72-86)src/Utils/request/query.ts (1)
query(87-94)src/types/inventory/supplyDelivery/supplyDelivery.ts (1)
SupplyDeliveryRead(64-72)src/components/Common/SkeletonLoading.tsx (1)
TableSkeleton(4-57)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: build
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: lint
- GitHub Check: CodeQL-Build
- GitHub Check: deploy-preview
🔇 Additional comments (8)
public/locale/en.json (1)
2163-2165: Good addition oferror_loading_deliveries; keep key name aligned with UI usage.This is consistent with existing
error_loading_*strings and is correctly placed/formatted in the JSON.src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (7)
1-9: LGTM!Import additions for
useQueriesanduseMemoare appropriate for the new parallel querying and memoization logic.
66-80: LGTM!The interface and function signature correctly updated to accept
deliveryOrderIds: string[], enabling per-delivery-order querying as intended by the fix.
94-105: LGTM!The
useQueriesimplementation correctly creates parallel queries for each delivery order ID with appropriate query keys for caching. The pattern aligns with TanStack Query best practices.
124-147: LGTM!The rendering logic correctly prioritizes error state, then loading, then content display. The error message uses i18n as required by coding guidelines.
215-223: LGTM!Proper memoization of
deliveryOrdersanddeliveryOrderIdsprevents unnecessary re-renders ofAllSupplyDeliveriesComponentwhen unrelated state changes occur.
779-785: LGTM!The updated prop
deliveryOrderIdscorrectly passes the memoized array to fetch deliveries from all associated delivery orders, addressing the root cause of issue #14955.
259-268: Verify consistency: this query still filters byrequest_order.This separate
allSupplyDeliveriesquery (used for calculatingdispatched_quantityin the "Requested Items" tab) still filters byrequest_order, which may exclude items added directly to Delivery Orders. This could lead to inconsistent dispatch counts vs. the "Received Items Summary" tab.Confirm whether the dispatched quantity calculation should also account for items not linked to the original supply request, or if showing only request-linked deliveries here is intentional.
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Outdated
Show resolved
Hide resolved
0676643 to
5b3c0f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
@src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx:
- Around line 134-137: The error message rendered in the RequestOrderShow
component when hasQueryError is true is not announced to screen readers; update
the conditional JSX that returns the <div> containing
t("error_loading_deliveries") so the element includes role="alert" (and
optionally aria-live="assertive") to ensure assistive technologies announce the
error; locate this in RequestOrderShow where hasQueryError controls the error
output and add the ARIA attribute to that div.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧰 Additional context used
📓 Path-based instructions (13)
public/locale/**/*.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use i18n Locale files with English Locale files in
public/locale/en.json- non-English languages managed via Crowdin only
Files:
public/locale/en.json
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Use declarative JSX
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use raviger for application routing in page components and route definitions
src/pages/**/*.{ts,tsx}: Keep page components insrc/pages/organized by feature
Use descriptive file names that reflect the page purpose
Export page components as default exports
Co-locate page-specific components and utilities with page components
Useravigerrouter for navigation (existing dependency)
Implement proper route parameters and query string handling
Handle navigation guards and authentication checks in page components
Implement proper loading states and error boundaries in page components
Use semantic HTML structure for accessibility in page components
Use@tanstack/react-queryfor API state management in page components (existing dependency)
Implement proper loading, error, and success states for data fetching
Handle pagination and infinite scroll patterns appropriately
Cache data appropriately in page components based on usage patterns
Use controlled components for form inputs in page components
Implement proper form validation withzodschemas in page components
Handle form submission states (loading, success, error) in page components
Use React hooks for local page state
Minimize unnecessary re-renders in page components
Implement proper authentication checks in page components
Handle different user roles and permissions in page components
Redirect to login when authentication is required in page components
Show appropriate UI based on user permissions in page components
Set appropriate page titles and meta descriptions in page components
Handle OpenGraph and Twitter card meta tags in page components
Implement structured data where applicable in page components
Implement code splitting for large page components
Use lazy loading for heavy components within page components
Optimize bundle size with proper imports in page components
Handle image optimization and lazy loading in page components
Implement comprehensive error boundaries in page components
Handle API e...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Tailwind CSS 4.1.3 utility classes with custom healthcare-specific design system for styling
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
**/*.tsx: Use functional components with proper type definitions in React
One component per file is preferred
Prefer default exports for React components
Follow the component naming pattern:ComponentName.tsxfor React components
Use Tailwind CSS for styling
Use Shadcn UI components when available
Use local state for component-specific data
Use PascalCase for component file names (e.g.,AuthWizard.tsx)
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧠 Learnings (34)
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to public/locale/**/*.json : Use i18n Locale files with English Locale files in `public/locale/en.json` - non-English languages managed via Crowdin only
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, translations are only added to the English locale (en.json) through pull requests. Other locale files are managed through Crowdin and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, new translation strings must only be added to the English locale (en.json) through pull requests. Translations for other languages (ta.json, mr.json, ml.json, hi.json, kn.json, etc.) are managed through Crowdin (https://crowdin.com/project/ohccarefe) and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-14T09:50:51.248Z
Learnt from: rajku-dev
Repo: ohcnetwork/care_fe PR: 9887
File: src/components/Users/CreateUserForm.tsx:86-92
Timestamp: 2025-01-14T09:50:51.248Z
Learning: When suggesting new validation messages or error strings in code, always ensure corresponding translation keys are added to the locale files (e.g., public/locale/en.json).
Applied to files:
public/locale/en.json
📚 Learning: 2025-11-14T14:26:31.165Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14348
File: src/components/Patient/TreatmentSummary.tsx:523-523
Timestamp: 2025-11-14T14:26:31.165Z
Learning: In TreatmentSummary.tsx, medication statements (from medicationStatementApi) only contain SNOMED-coded medications and use `medication.medication.display ?? medication.medication.code` pattern, whereas medication requests (from medicationRequestApi) can have either SNOMED codes or inventory products and should use `displayMedicationName()` helper function to correctly handle both cases.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Use `tanstack/react-query` for server state management with facility data and patient records
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components with React Query for real-time data from medical API endpoints
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components cleanly with healthcare data sources and support live data updates for critical medical information
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2024-11-06T07:49:19.355Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 8781
File: src/components/Facility/ConsultationDetails/Events/EventsList.tsx:67-72
Timestamp: 2024-11-06T07:49:19.355Z
Learning: In `src/components/Facility/ConsultationDetails/Events/EventsList.tsx`, appending ' VENTILATOR' to `values.ventilator_interface` when it is 'INVASIVE' or 'NON_INVASIVE' is required to display the correct values in daily logs, as per requirements.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading, error, and success states for data fetching
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement loading, error, and success states for async operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Implement proper error handling using the global error handler for TanStack Query operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading states and error boundaries in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Handle loading, error, and success states consistently across all providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:20.837Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/typescript-types.instructions.md:0-0
Timestamp: 2025-11-25T13:53:20.837Z
Learning: Applies to src/types/**/*{Query,Result}*.{ts,tsx} : React Query integration types should export query result types with data, isLoading, error, and refetch properties for API operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-08T07:49:59.494Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9748
File: src/pages/Organization/components/OrganizationFilter.tsx:0-0
Timestamp: 2025-01-08T07:49:59.494Z
Learning: The project implements global error handling for React Query errors, making local error handling in individual query hooks unnecessary.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-20T09:11:54.138Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9768
File: src/components/Resource/ResourcePage.tsx:80-89
Timestamp: 2025-01-20T09:11:54.138Z
Learning: In the care_fe project, useQuery and useMutation hooks have global error handlers. Additional error handlers should only be added when specific functionality is needed beyond the global handler. In such cases, prefer using built-in params like isSuccess and isError from useQuery/useMutation.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-02-04T12:39:49.688Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10352
File: src/Providers/AuthUserProvider.tsx:47-63
Timestamp: 2025-02-04T12:39:49.688Z
Learning: The `onError` callback option was removed from `useQuery` in TanStack Query v5. Error handling should be done by checking the `error` state directly or using Error Boundaries.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use `tanstack/react-query` for API state management in page components (existing dependency)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use tanstack/react-query for server state management in API client code
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Integrate with tanstack/react-query for server state management in providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-31T22:13:06.153Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10345
File: src/components/Resource/ResourceDetailsUpdate.tsx:132-145
Timestamp: 2025-01-31T22:13:06.153Z
Learning: The migration from useTanStackQueryInstead to useQuery in React components requires:
1. Updating types to use UseQueryResult instead of custom hook return type
2. Replacing loading with isLoading property
3. Using queryKey array for cache management
4. Using queryFn with query utility function
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Optimize CAREUI components for memory efficiency for long-running clinical applications
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Use `useState` for local state and `tanstack/react-query` for server state in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{tsx,ts} : Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement memoization for expensive computations in utility functions
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-09T08:56:20.178Z
Learnt from: i0am0arunava
Repo: ohcnetwork/care_fe PR: 9801
File: src/pages/Organization/OrganizationFacilities.tsx:69-75
Timestamp: 2025-01-09T08:56:20.178Z
Learning: When using useDebouncedState with query parameters in TypeScript, ensure the debounced state maintains the same type as the original state (QueryParam). Avoid splitting into separate string states as it breaks type safety.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useMutation` hook with `mutationFn` parameter wrapping API routes with the `mutate()` utility, and implement `onSuccess` callbacks to invalidate related queries
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Leverage TanStack Query built-in features for pagination and debouncing
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query with the `query` and `mutate` utilities from `@/Utils/request/`
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-03T16:26:08.045Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9708
File: src/components/Users/UserResetPassword.tsx:72-89
Timestamp: 2025-01-03T16:26:08.045Z
Learning: When using react-query’s mutate, avoid chaining the calls as "() => mutate(...)(...)" and just call "mutate(...)" directly, relying on its built-in error handling and the global notification dispatcher.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-17T19:47:58.152Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14821
File: src/components/Location/LocationNavigation.tsx:161-163
Timestamp: 2025-12-17T19:47:58.152Z
Learning: To ensure the remove-unused-i18n.js cleanup script detects i18n keys, avoid wrapping keys inside a ternary expression passed directly to t(). Instead, call t() separately in each branch of a conditional, e.g. condition ? t("key1") : t("key2"), or compute the key in a variable before passing to t(). For LocationNavigation.tsx (and similar TSX files in the repo), prefer explicit separate i18n calls per branch or a shared precomputed key to guarantee all keys are statically detectable by the script.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-22T10:16:36.690Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 14804
File: src/pages/Facility/services/pharmacy/DispensesView.tsx:117-135
Timestamp: 2025-12-22T10:16:36.690Z
Learning: In the care_fe repository, prefer the native HTML title attribute for simple tooltips over using shadcn/ui Tooltip components. Use Tooltip components only when the tooltip requires richer content, interactivity, or accessibility enhancements that cannot be achieved with a plain title. For simple cases, add a title attribute to the element (e.g., <span title="...">). If a Tooltip is used, ensure it is accessible and necessary, and avoid duplicating content available in the title attribute.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: deploy-preview
🔇 Additional comments (7)
public/locale/en.json (1)
2164-2164: LGTM: translation key is consistent and appropriately scoped.
The newerror_loading_deliverieskey matches the existingerror_loading_*convention and the message is clear.src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (6)
1-9: LGTM!Imports are correctly updated to include
useQueriesfor parallel fetching anduseMemofor memoization, supporting the new multi-delivery-order fetching pattern.
66-80: LGTM!The interface change from
requestOrderId: stringtodeliveryOrderIds: string[]correctly supports the new fetching strategy that queries all delivery orders associated with a request order, addressing the issue where items added directly to Delivery Orders were being excluded.
94-130: Well-implemented parallel fetching with deduplication.The
useQuerieswithcombineis a clean approach for aggregating results from multiple delivery orders. The O(n) deduplication using aSetis efficient, and the aggregatedisLoading/isErrorstates correctly reflect the status of all parallel queries.
223-231: LGTM!The memoization of
deliveryOrdersanddeliveryOrderIdsis correctly implemented. This ensures stable array references are passed toAllSupplyDeliveriesComponent, preventing unnecessary re-renders and query re-executions when the parent component re-renders but the delivery data hasn't changed.
787-793: LGTM!The prop change from
requestOrderIdtodeliveryOrderIdscorrectly wires the parent component to the updatedAllSupplyDeliveriesComponent, completing the implementation of the fix for including items from all associated delivery orders.
267-296: Verify if this query should also use delivery order IDs for consistency with AllSupplyDeliveriesComponent.This
allSupplyDeliveriesquery filters byrequest_order: requestOrderId, while theAllSupplyDeliveriesComponentabove uses delivery order filtering (order: id). The query is used to calculatedispatched_quantityfor items in the "Requested Items" tab.If items added directly to Delivery Orders (not linked to the original supply request) should count toward dispatched quantities, this query needs to also adopt the delivery-order-based filtering approach for consistency. If the current behavior is intentional—counting only items that match supply request lines—then no change is needed.
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Show resolved
Hide resolved
5b3c0f7 to
109547a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (1)
132-156: Guard againstdatabeing undefined before calling.length.
Depending onuseQueriestyping/behavior,allSupplyDeliveriescan still beundefined; current code would throw.Proposed fix
- return ( + const deliveries = allSupplyDeliveries ?? []; + + return ( <div className="space-y-4 max-h-[68vh] overflow-y-auto px-4 pt-4"> {hasQueryError ? ( <div className="text-red-500 text-center py-4" role="alert" aria-live="assertive" > {t("error_loading_deliveries")} </div> ) : isLoadingAllSupplyDeliveries ? ( <TableSkeleton count={3} /> - ) : allSupplyDeliveries.length > 0 ? ( + ) : deliveries.length > 0 ? ( <SupplyDeliveryTable - deliveries={allSupplyDeliveries} + deliveries={deliveries} internal={internal} isRequester={isRequester} /> ) : (
🤖 Fix all issues with AI agents
In
@src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx:
- Around line 94-130: The query keys for useQueries currently include the object
qParams and thus are unstable; also queries run when deliveryOrderIds is empty.
Update the queries created in useQueries (where queryKey is ["supplyDeliveries",
id, qParams]) to instead use only primitive values derived from qParams (e.g.,
facilityId, id, qParams.internal, and selectedProductKnowledge?.id) so the keys
are stable, and add an enabled flag to each query (or to useQueries) that gates
fetching with deliveryOrderIds.length > 0 to prevent firing API calls when there
are no IDs to fetch.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧰 Additional context used
📓 Path-based instructions (13)
public/locale/**/*.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use i18n Locale files with English Locale files in
public/locale/en.json- non-English languages managed via Crowdin only
Files:
public/locale/en.json
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Use declarative JSX
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use raviger for application routing in page components and route definitions
src/pages/**/*.{ts,tsx}: Keep page components insrc/pages/organized by feature
Use descriptive file names that reflect the page purpose
Export page components as default exports
Co-locate page-specific components and utilities with page components
Useravigerrouter for navigation (existing dependency)
Implement proper route parameters and query string handling
Handle navigation guards and authentication checks in page components
Implement proper loading states and error boundaries in page components
Use semantic HTML structure for accessibility in page components
Use@tanstack/react-queryfor API state management in page components (existing dependency)
Implement proper loading, error, and success states for data fetching
Handle pagination and infinite scroll patterns appropriately
Cache data appropriately in page components based on usage patterns
Use controlled components for form inputs in page components
Implement proper form validation withzodschemas in page components
Handle form submission states (loading, success, error) in page components
Use React hooks for local page state
Minimize unnecessary re-renders in page components
Implement proper authentication checks in page components
Handle different user roles and permissions in page components
Redirect to login when authentication is required in page components
Show appropriate UI based on user permissions in page components
Set appropriate page titles and meta descriptions in page components
Handle OpenGraph and Twitter card meta tags in page components
Implement structured data where applicable in page components
Implement code splitting for large page components
Use lazy loading for heavy components within page components
Optimize bundle size with proper imports in page components
Handle image optimization and lazy loading in page components
Implement comprehensive error boundaries in page components
Handle API e...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Tailwind CSS 4.1.3 utility classes with custom healthcare-specific design system for styling
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
**/*.tsx: Use functional components with proper type definitions in React
One component per file is preferred
Prefer default exports for React components
Follow the component naming pattern:ComponentName.tsxfor React components
Use Tailwind CSS for styling
Use Shadcn UI components when available
Use local state for component-specific data
Use PascalCase for component file names (e.g.,AuthWizard.tsx)
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧠 Learnings (42)
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to public/locale/**/*.json : Use i18n Locale files with English Locale files in `public/locale/en.json` - non-English languages managed via Crowdin only
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, translations are only added to the English locale (en.json) through pull requests. Other locale files are managed through Crowdin and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, new translation strings must only be added to the English locale (en.json) through pull requests. Translations for other languages (ta.json, mr.json, ml.json, hi.json, kn.json, etc.) are managed through Crowdin (https://crowdin.com/project/ohccarefe) and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-14T09:50:51.248Z
Learnt from: rajku-dev
Repo: ohcnetwork/care_fe PR: 9887
File: src/components/Users/CreateUserForm.tsx:86-92
Timestamp: 2025-01-14T09:50:51.248Z
Learning: When suggesting new validation messages or error strings in code, always ensure corresponding translation keys are added to the locale files (e.g., public/locale/en.json).
Applied to files:
public/locale/en.json
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Use `tanstack/react-query` for server state management with facility data and patient records
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-14T14:26:31.165Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14348
File: src/components/Patient/TreatmentSummary.tsx:523-523
Timestamp: 2025-11-14T14:26:31.165Z
Learning: In TreatmentSummary.tsx, medication statements (from medicationStatementApi) only contain SNOMED-coded medications and use `medication.medication.display ?? medication.medication.code` pattern, whereas medication requests (from medicationRequestApi) can have either SNOMED codes or inventory products and should use `displayMedicationName()` helper function to correctly handle both cases.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components with React Query for real-time data from medical API endpoints
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use `tanstack/react-query` for API state management in page components (existing dependency)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-31T22:13:06.153Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10345
File: src/components/Resource/ResourceDetailsUpdate.tsx:132-145
Timestamp: 2025-01-31T22:13:06.153Z
Learning: The migration from useTanStackQueryInstead to useQuery in React components requires:
1. Updating types to use UseQueryResult instead of custom hook return type
2. Replacing loading with isLoading property
3. Using queryKey array for cache management
4. Using queryFn with query utility function
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query with the `query` and `mutate` utilities from `@/Utils/request/`
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading, error, and success states for data fetching
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement loading, error, and success states for async operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Implement proper error handling using the global error handler for TanStack Query operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading states and error boundaries in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:20.837Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/typescript-types.instructions.md:0-0
Timestamp: 2025-11-25T13:53:20.837Z
Learning: Applies to src/types/**/*{Query,Result}*.{ts,tsx} : React Query integration types should export query result types with data, isLoading, error, and refetch properties for API operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Handle loading, error, and success states consistently across all providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-08T07:49:59.494Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9748
File: src/pages/Organization/components/OrganizationFilter.tsx:0-0
Timestamp: 2025-01-08T07:49:59.494Z
Learning: The project implements global error handling for React Query errors, making local error handling in individual query hooks unnecessary.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-20T09:11:54.138Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9768
File: src/components/Resource/ResourcePage.tsx:80-89
Timestamp: 2025-01-20T09:11:54.138Z
Learning: In the care_fe project, useQuery and useMutation hooks have global error handlers. Additional error handlers should only be added when specific functionality is needed beyond the global handler. In such cases, prefer using built-in params like isSuccess and isError from useQuery/useMutation.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-02-04T12:39:49.688Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10352
File: src/Providers/AuthUserProvider.tsx:47-63
Timestamp: 2025-02-04T12:39:49.688Z
Learning: The `onError` callback option was removed from `useQuery` in TanStack Query v5. Error handling should be done by checking the `error` state directly or using Error Boundaries.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use tanstack/react-query for server state management in API client code
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Integrate with tanstack/react-query for server state management in providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Optimize CAREUI components for memory efficiency for long-running clinical applications
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Use `useState` for local state and `tanstack/react-query` for server state in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components cleanly with healthcare data sources and support live data updates for critical medical information
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{tsx,ts} : Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement memoization for expensive computations in utility functions
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-09T08:56:20.178Z
Learnt from: i0am0arunava
Repo: ohcnetwork/care_fe PR: 9801
File: src/pages/Organization/OrganizationFacilities.tsx:69-75
Timestamp: 2025-01-09T08:56:20.178Z
Learning: When using useDebouncedState with query parameters in TypeScript, ensure the debounced state maintains the same type as the original state (QueryParam). Avoid splitting into separate string states as it breaks type safety.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useMutation` hook with `mutationFn` parameter wrapping API routes with the `mutate()` utility, and implement `onSuccess` callbacks to invalidate related queries
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:35.875Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/04-ui-components.mdc:0-0
Timestamp: 2025-11-25T13:54:35.875Z
Learning: Applies to **/*.{tsx,ts} : Implement proper ARIA attributes for accessibility
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Add ARIA labels for critical medical data (patient names, vital signs, medication alerts)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use proper ARIA labels and roles in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement comprehensive screen reader support - All medical data must be accessible via assistive technology with proper ARIA labels for medical context and urgency
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement WCAG 2.1 AA accessibility compliance in medical applications with screen reader compatibility and keyboard navigation
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Maintain proper heading hierarchy for screen reader support in medical records display
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Ensure keyboard navigation is supported for clinical workflows and emergency situations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement robust error handling with user-friendly medical context in CAREUI components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Provide clear and visible focus indicators for complex medical workflows in CAREUI components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-03T16:26:08.045Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9708
File: src/components/Users/UserResetPassword.tsx:72-89
Timestamp: 2025-01-03T16:26:08.045Z
Learning: When using react-query’s mutate, avoid chaining the calls as "() => mutate(...)(...)" and just call "mutate(...)" directly, relying on its built-in error handling and the global notification dispatcher.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-17T19:47:58.152Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14821
File: src/components/Location/LocationNavigation.tsx:161-163
Timestamp: 2025-12-17T19:47:58.152Z
Learning: To ensure the remove-unused-i18n.js cleanup script detects i18n keys, avoid wrapping keys inside a ternary expression passed directly to t(). Instead, call t() separately in each branch of a conditional, e.g. condition ? t("key1") : t("key2"), or compute the key in a variable before passing to t(). For LocationNavigation.tsx (and similar TSX files in the repo), prefer explicit separate i18n calls per branch or a shared precomputed key to guarantee all keys are statically detectable by the script.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-22T10:16:36.690Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 14804
File: src/pages/Facility/services/pharmacy/DispensesView.tsx:117-135
Timestamp: 2025-12-22T10:16:36.690Z
Learning: In the care_fe repository, prefer the native HTML title attribute for simple tooltips over using shadcn/ui Tooltip components. Use Tooltip components only when the tooltip requires richer content, interactivity, or accessibility enhancements that cannot be achieved with a plain title. For simple cases, add a title attribute to the element (e.g., <span title="...">). If a Tooltip is used, ensure it is accessible and necessary, and avoid duplicating content available in the title attribute.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧬 Code graph analysis (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (3)
src/Utils/request/query.ts (1)
query(87-94)src/types/inventory/supplyDelivery/supplyDelivery.ts (1)
SupplyDeliveryRead(64-72)src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx (1)
SupplyDeliveryTable(56-341)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: build
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: CodeQL-Build
- GitHub Check: lint
- GitHub Check: deploy-preview
🔇 Additional comments (7)
public/locale/en.json (1)
2163-2166: New i18n key is properly used in the codebase.The key is correctly referenced in
RequestOrderShow.tsxwith exact spelling. The addition follows the English-only convention for PRs.src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (6)
1-6: Import change looks fine (useQueries + React hooks).
No concerns with addinguseQueriesanduseMemousage here.Also applies to: 9-9
66-80: Props change todeliveryOrderIds: string[]is the right direction for the bug fix.
This aligns the component API with the objective (include items from all associated delivery orders).
109-129: Combine + Set-based dedupe is solid and O(n).
Good approach for overlapping per-order results without quadratic scans.
227-235: MemoizingdeliveryOrders+deliveryOrderIdsis fine (prevents churn).
This should help keepdeliveryOrderIdsstable for downstream query configs.
83-92: The undefined filter inmakeQueryParamsalready handles this safely; the proposed fix is unnecessary.The request utilities in
src/Utils/request/utils.ts(line 43) explicitly filter outundefinedvalues:if (value === undefined) return;. This check runs inmakeQueryParams()before any query string is serialized, so undefined values never become URL parameters—regardless of howqParamsis constructed. The original code is safe as-is.Likely an incorrect or invalid review comment.
791-797: AddisActiveprop to gate data fetching;AllSupplyDeliveriesComponentcurrently fetches even when the "items-summary" tab is inactive.Since
NavTabsrenders all tab content (hidden via CSS),AllSupplyDeliveriesComponentmounts and executes itsuseQuerieswithout anenabledcondition, causing unnecessary API calls. Pass anisActiveprop and addenabled: isActiveto the query configuration to prevent prefetching.
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Show resolved
Hide resolved
109547a to
2b2ce77
Compare
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (1)
66-80: Prevent premature “no deliveries found” while delivery orders are still loading. Right now, if the user opens Items Summary beforedeliveryOrdersDataresolves,deliveryOrderIdsis[], souseQuerieshas no work andisLoadingAllSupplyDeliveriesis false—leading to an incorrect empty state.Proposed fix (gate the table/empty state on deliveryOrders loading)
interface AllSupplyDeliveriesProps { facilityId: string; deliveryOrderIds: string[]; + isLoadingDeliveryOrders: boolean; selectedProductKnowledge?: ProductKnowledgeBase; internal: boolean; isRequester: boolean; } function AllSupplyDeliveriesComponent({ facilityId, deliveryOrderIds, + isLoadingDeliveryOrders, selectedProductKnowledge, internal, isRequester, }: AllSupplyDeliveriesProps) { const { t } = useTranslation(); @@ - const { - data: allSupplyDeliveries, + const { + data: allSupplyDeliveries = [], isLoading: isLoadingAllSupplyDeliveries, isError: hasQueryError, } = useQueries({ @@ return ( <div className="space-y-4 max-h-[68vh] overflow-y-auto px-4 pt-4"> {hasQueryError ? ( @@ - ) : isLoadingAllSupplyDeliveries ? ( + ) : isLoadingDeliveryOrders || isLoadingAllSupplyDeliveries ? ( <TableSkeleton count={3} /> ) : allSupplyDeliveries.length > 0 ? ( <SupplyDeliveryTable deliveries={allSupplyDeliveries} internal={internal} isRequester={isRequester} /> ) : ( <EmptyState icon={<Truck className="text-primary size-5" />} title={t("no_deliveries_found")} description={t("deliveries_will_appear_here")} /> )} </div> ); } @@ <AllSupplyDeliveriesComponent facilityId={facilityId} deliveryOrderIds={deliveryOrderIds} + isLoadingDeliveryOrders={isLoadingDeliveryOrders} internal={internal} selectedProductKnowledge={selectedProductKnowledge} isRequester={isRequester} />Also applies to: 139-165, 798-804
🤖 Fix all issues with AI agents
In
@src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx:
- Around line 94-137: The combine function in the useQueries call that produces
allSupplyDeliveries currently sets isError via results.some(r => r.isError),
which treats any single query failure as a global error and hides successful
data; change this to report a non-blocking/partial-error state (e.g., set
isError to results.every(r => r.isError) or add a separate partialError flag
like hasPartialErrors = results.some(r => r.isError) while keeping data from
successful results), update the returned shape accordingly, and adjust
downstream consumers (hasQueryError and any render logic) to render available
combinedDeliveries while showing a warning when partial errors exist; apply the
same fix to the other similar useQueries block at the later occurrence (lines
referenced in the review).
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧰 Additional context used
📓 Path-based instructions (13)
public/locale/**/*.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use i18n Locale files with English Locale files in
public/locale/en.json- non-English languages managed via Crowdin only
Files:
public/locale/en.json
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Use declarative JSX
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use raviger for application routing in page components and route definitions
src/pages/**/*.{ts,tsx}: Keep page components insrc/pages/organized by feature
Use descriptive file names that reflect the page purpose
Export page components as default exports
Co-locate page-specific components and utilities with page components
Useravigerrouter for navigation (existing dependency)
Implement proper route parameters and query string handling
Handle navigation guards and authentication checks in page components
Implement proper loading states and error boundaries in page components
Use semantic HTML structure for accessibility in page components
Use@tanstack/react-queryfor API state management in page components (existing dependency)
Implement proper loading, error, and success states for data fetching
Handle pagination and infinite scroll patterns appropriately
Cache data appropriately in page components based on usage patterns
Use controlled components for form inputs in page components
Implement proper form validation withzodschemas in page components
Handle form submission states (loading, success, error) in page components
Use React hooks for local page state
Minimize unnecessary re-renders in page components
Implement proper authentication checks in page components
Handle different user roles and permissions in page components
Redirect to login when authentication is required in page components
Show appropriate UI based on user permissions in page components
Set appropriate page titles and meta descriptions in page components
Handle OpenGraph and Twitter card meta tags in page components
Implement structured data where applicable in page components
Implement code splitting for large page components
Use lazy loading for heavy components within page components
Optimize bundle size with proper imports in page components
Handle image optimization and lazy loading in page components
Implement comprehensive error boundaries in page components
Handle API e...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Tailwind CSS 4.1.3 utility classes with custom healthcare-specific design system for styling
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
**/*.tsx: Use functional components with proper type definitions in React
One component per file is preferred
Prefer default exports for React components
Follow the component naming pattern:ComponentName.tsxfor React components
Use Tailwind CSS for styling
Use Shadcn UI components when available
Use local state for component-specific data
Use PascalCase for component file names (e.g.,AuthWizard.tsx)
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧠 Learnings (44)
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to public/locale/**/*.json : Use i18n Locale files with English Locale files in `public/locale/en.json` - non-English languages managed via Crowdin only
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, translations are only added to the English locale (en.json) through pull requests. Other locale files are managed through Crowdin and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, new translation strings must only be added to the English locale (en.json) through pull requests. Translations for other languages (ta.json, mr.json, ml.json, hi.json, kn.json, etc.) are managed through Crowdin (https://crowdin.com/project/ohccarefe) and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Use `tanstack/react-query` for server state management with facility data and patient records
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components with React Query for real-time data from medical API endpoints
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-14T14:26:31.165Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14348
File: src/components/Patient/TreatmentSummary.tsx:523-523
Timestamp: 2025-11-14T14:26:31.165Z
Learning: In TreatmentSummary.tsx, medication statements (from medicationStatementApi) only contain SNOMED-coded medications and use `medication.medication.display ?? medication.medication.code` pattern, whereas medication requests (from medicationRequestApi) can have either SNOMED codes or inventory products and should use `displayMedicationName()` helper function to correctly handle both cases.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use `tanstack/react-query` for API state management in page components (existing dependency)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading, error, and success states for data fetching
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement loading, error, and success states for async operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Implement proper error handling using the global error handler for TanStack Query operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading states and error boundaries in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Handle loading, error, and success states consistently across all providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:20.837Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/typescript-types.instructions.md:0-0
Timestamp: 2025-11-25T13:53:20.837Z
Learning: Applies to src/types/**/*{Query,Result}*.{ts,tsx} : React Query integration types should export query result types with data, isLoading, error, and refetch properties for API operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-08T07:49:59.494Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9748
File: src/pages/Organization/components/OrganizationFilter.tsx:0-0
Timestamp: 2025-01-08T07:49:59.494Z
Learning: The project implements global error handling for React Query errors, making local error handling in individual query hooks unnecessary.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-20T09:11:54.138Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9768
File: src/components/Resource/ResourcePage.tsx:80-89
Timestamp: 2025-01-20T09:11:54.138Z
Learning: In the care_fe project, useQuery and useMutation hooks have global error handlers. Additional error handlers should only be added when specific functionality is needed beyond the global handler. In such cases, prefer using built-in params like isSuccess and isError from useQuery/useMutation.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-02-04T12:39:49.688Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10352
File: src/Providers/AuthUserProvider.tsx:47-63
Timestamp: 2025-02-04T12:39:49.688Z
Learning: The `onError` callback option was removed from `useQuery` in TanStack Query v5. Error handling should be done by checking the `error` state directly or using Error Boundaries.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement proper error boundaries in CAREUI components for critical medical data handling
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use tanstack/react-query for server state management in API client code
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Integrate with tanstack/react-query for server state management in providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-31T22:13:06.153Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10345
File: src/components/Resource/ResourceDetailsUpdate.tsx:132-145
Timestamp: 2025-01-31T22:13:06.153Z
Learning: The migration from useTanStackQueryInstead to useQuery in React components requires:
1. Updating types to use UseQueryResult instead of custom hook return type
2. Replacing loading with isLoading property
3. Using queryKey array for cache management
4. Using queryFn with query utility function
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Optimize CAREUI components for memory efficiency for long-running clinical applications
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Use `useState` for local state and `tanstack/react-query` for server state in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components cleanly with healthcare data sources and support live data updates for critical medical information
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{tsx,ts} : Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement memoization for expensive computations in utility functions
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-09T08:56:20.178Z
Learnt from: i0am0arunava
Repo: ohcnetwork/care_fe PR: 9801
File: src/pages/Organization/OrganizationFacilities.tsx:69-75
Timestamp: 2025-01-09T08:56:20.178Z
Learning: When using useDebouncedState with query parameters in TypeScript, ensure the debounced state maintains the same type as the original state (QueryParam). Avoid splitting into separate string states as it breaks type safety.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useMutation` hook with `mutationFn` parameter wrapping API routes with the `mutate()` utility, and implement `onSuccess` callbacks to invalidate related queries
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:35.875Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/04-ui-components.mdc:0-0
Timestamp: 2025-11-25T13:54:35.875Z
Learning: Applies to **/*.{tsx,ts} : Implement proper ARIA attributes for accessibility
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Add ARIA labels for critical medical data (patient names, vital signs, medication alerts)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use proper ARIA labels and roles in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement comprehensive screen reader support - All medical data must be accessible via assistive technology with proper ARIA labels for medical context and urgency
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement WCAG 2.1 AA accessibility compliance in medical applications with screen reader compatibility and keyboard navigation
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Maintain proper heading hierarchy for screen reader support in medical records display
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Ensure keyboard navigation is supported for clinical workflows and emergency situations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement robust error handling with user-friendly medical context in CAREUI components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useQuery` hook with `queryKey` and `queryFn` parameters, where `queryFn` wraps the API route with the `query()` utility
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-05T19:05:40.922Z
Learnt from: pratyush07-hub
Repo: ohcnetwork/care_fe PR: 14651
File: src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx:252-257
Timestamp: 2025-12-05T19:05:40.922Z
Learning: In healthcare components handling discharge status (like EncounterQuestion.tsx), maintainers implement defense-in-depth by adding early-return guards in change handlers (e.g., `if (isDischarged) return;`) even when the UI control is also disabled, to ensure business-critical immutability rules are enforced at multiple layers and protect against edge cases like browser extensions or unexpected UI library behavior.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use appropriate query keys following the resource pattern for TanStack Query
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query with the `query` and `mutate` utilities from `@/Utils/request/`
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-03T16:26:08.045Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9708
File: src/components/Users/UserResetPassword.tsx:72-89
Timestamp: 2025-01-03T16:26:08.045Z
Learning: When using react-query’s mutate, avoid chaining the calls as "() => mutate(...)(...)" and just call "mutate(...)" directly, relying on its built-in error handling and the global notification dispatcher.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-17T19:47:58.152Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14821
File: src/components/Location/LocationNavigation.tsx:161-163
Timestamp: 2025-12-17T19:47:58.152Z
Learning: To ensure the remove-unused-i18n.js cleanup script detects i18n keys, avoid wrapping keys inside a ternary expression passed directly to t(). Instead, call t() separately in each branch of a conditional, e.g. condition ? t("key1") : t("key2"), or compute the key in a variable before passing to t(). For LocationNavigation.tsx (and similar TSX files in the repo), prefer explicit separate i18n calls per branch or a shared precomputed key to guarantee all keys are statically detectable by the script.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-22T10:16:36.690Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 14804
File: src/pages/Facility/services/pharmacy/DispensesView.tsx:117-135
Timestamp: 2025-12-22T10:16:36.690Z
Learning: In the care_fe repository, prefer the native HTML title attribute for simple tooltips over using shadcn/ui Tooltip components. Use Tooltip components only when the tooltip requires richer content, interactivity, or accessibility enhancements that cannot be achieved with a plain title. For simple cases, add a title attribute to the element (e.g., <span title="...">). If a Tooltip is used, ensure it is accessible and necessary, and avoid duplicating content available in the title attribute.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧬 Code graph analysis (1)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (2)
src/Utils/request/query.ts (1)
query(87-94)src/types/inventory/supplyDelivery/supplyDelivery.ts (1)
SupplyDeliveryRead(64-72)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: assign-pr
- GitHub Check: build
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: deploy-preview
- GitHub Check: CodeQL-Build
- GitHub Check: Test
🔇 Additional comments (4)
public/locale/en.json (1)
2163-2165: English locale-only change is correct. The keyerror_loading_deliveriesis properly defined and used insrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsxwith exact spelling and casing match, with no duplicates.src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (3)
1-6: Imports look consistent with the new approach.Also applies to: 9-9, 58-58
234-242: Memoization ofdeliveryOrders/deliveryOrderIdsis good; verify dispatched-quantity math isn’t still missing “extra” items. You now havedeliveryOrderIdsavailable; however, the requested-items tab still computes dispatched quantities from a request_order-filtered deliveries query later in this file, which may continue to exclude unlinked delivery lines (the original bug class). Confirm whether that’s acceptable for requested-items, or if it should also be derived fromdeliveryOrderIds.
94-137: No issues found. TheuseQueries({ combine })pattern is fully supported in TanStack Query v5.83.0 (installed), andquery.paginated()correctly returns{ count, results: items }. The code properly accesses this shape viares.data?.resultsand follows the same pattern used elsewhere in the codebase (e.g.,PluginEngine.tsx).
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
Show resolved
Hide resolved
2b2ce77 to
56978dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @public/locale/en.json:
- Line 5050: The translation key "some_deliveries_failed_to_load" currently ends
with a period but may be used as a short title/toast; update the value to be
consistent with other short titles by removing the trailing period (change "Some
deliveries failed to load." to "Some deliveries failed to load"), then search
for usages of some_deliveries_failed_to_load to confirm it’s used as a
heading/toast and, if so, update other locale files to match punctuation for
consistency.
- Line 2164: The localization string for "error_loading_deliveries" is
ambiguous; update the value to explicitly indicate the intended scope (e.g.,
"Error loading delivery orders" or "Error loading supply deliveries") so users
aren’t confused by other "deliveries" contexts; locate the key
"error_loading_deliveries" in the en.json file and replace the current value
with the clearer phrase that matches the app context, and ensure any
corresponding keys in other locale files are updated consistently.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧰 Additional context used
📓 Path-based instructions (13)
public/locale/**/*.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use i18n Locale files with English Locale files in
public/locale/en.json- non-English languages managed via Crowdin only
Files:
public/locale/en.json
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx,json,css,scss,html}
📄 CodeRabbit inference engine (AGENTS.md)
Use 2-space indentation
Files:
public/locale/en.jsonsrc/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types in TypeScript
Avoid explicitanytype in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks
**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid usinganytype; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management
**/*.{ts,tsx}: Use TanStack Query with thequeryandmutateutilities from@/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
UseuseQueryhook withqueryKeyandqueryFnparameters, wherequeryFnwraps the API route with thequery()utility
UseuseMutationhook withmutationFnparameter wrapping API routes with themutate()utility, and implementonSuccesscallbacks to invalidate related queries
Support path parameters in TanStack Query using thepathParamsoption in query/mutate utilities
Support query parameters in TanStack Query using thequeryParamsoption in query/mutate utilities
Use thesilent: trueoption to suppress global error notifications when custom error handling is needed
**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Useinterfacefor defining object types
Avoid explicitanytypes and maint...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
**/*.{ts,tsx,js,jsx}: Use path aliases@/*for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Use declarative JSX
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Prettier for consistent code formatting across the healthcare application
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use raviger for application routing in page components and route definitions
src/pages/**/*.{ts,tsx}: Keep page components insrc/pages/organized by feature
Use descriptive file names that reflect the page purpose
Export page components as default exports
Co-locate page-specific components and utilities with page components
Useravigerrouter for navigation (existing dependency)
Implement proper route parameters and query string handling
Handle navigation guards and authentication checks in page components
Implement proper loading states and error boundaries in page components
Use semantic HTML structure for accessibility in page components
Use@tanstack/react-queryfor API state management in page components (existing dependency)
Implement proper loading, error, and success states for data fetching
Handle pagination and infinite scroll patterns appropriately
Cache data appropriately in page components based on usage patterns
Use controlled components for form inputs in page components
Implement proper form validation withzodschemas in page components
Handle form submission states (loading, success, error) in page components
Use React hooks for local page state
Minimize unnecessary re-renders in page components
Implement proper authentication checks in page components
Handle different user roles and permissions in page components
Redirect to login when authentication is required in page components
Show appropriate UI based on user permissions in page components
Set appropriate page titles and meta descriptions in page components
Handle OpenGraph and Twitter card meta tags in page components
Implement structured data where applicable in page components
Implement code splitting for large page components
Use lazy loading for heavy components within page components
Optimize bundle size with proper imports in page components
Handle image optimization and lazy loading in page components
Implement comprehensive error boundaries in page components
Handle API e...
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
src/**/*.{tsx,css}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Tailwind CSS 4.1.3 utility classes with custom healthcare-specific design system for styling
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)
**/*.tsx: Use functional components with proper type definitions in React
One component per file is preferred
Prefer default exports for React components
Follow the component naming pattern:ComponentName.tsxfor React components
Use Tailwind CSS for styling
Use Shadcn UI components when available
Use local state for component-specific data
Use PascalCase for component file names (e.g.,AuthWizard.tsx)
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
UsenavigateanduseRedirectfrom raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys fromsrc/Locale/for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support
Files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
🧠 Learnings (47)
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to public/locale/**/*.json : Use i18n Locale files with English Locale files in `public/locale/en.json` - non-English languages managed via Crowdin only
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-14T09:50:51.248Z
Learnt from: rajku-dev
Repo: ohcnetwork/care_fe PR: 9887
File: src/components/Users/CreateUserForm.tsx:86-92
Timestamp: 2025-01-14T09:50:51.248Z
Learning: When suggesting new validation messages or error strings in code, always ensure corresponding translation keys are added to the locale files (e.g., public/locale/en.json).
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-15T04:16:14.978Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9956
File: src/pages/Patient/index.tsx:71-71
Timestamp: 2025-01-15T04:16:14.978Z
Learning: In this project, translations are only added to the English locale (en.json) through pull requests. Other locale files are managed through Crowdin and should not be modified directly in PRs.
Applied to files:
public/locale/en.json
📚 Learning: 2025-01-14T09:50:51.248Z
Learnt from: rajku-dev
Repo: ohcnetwork/care_fe PR: 9887
File: src/components/Users/CreateUserForm.tsx:86-92
Timestamp: 2025-01-14T09:50:51.248Z
Learning: When suggesting new validation messages in code, always check and add corresponding translation keys to the locale files (e.g., public/locale/en.json) to maintain internationalization support.
Applied to files:
public/locale/en.json
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Use `tanstack/react-query` for server state management with facility data and patient records
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-14T14:26:31.165Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14348
File: src/components/Patient/TreatmentSummary.tsx:523-523
Timestamp: 2025-11-14T14:26:31.165Z
Learning: In TreatmentSummary.tsx, medication statements (from medicationStatementApi) only contain SNOMED-coded medications and use `medication.medication.display ?? medication.medication.code` pattern, whereas medication requests (from medicationRequestApi) can have either SNOMED codes or inventory products and should use `displayMedicationName()` helper function to correctly handle both cases.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components with React Query for real-time data from medical API endpoints
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-31T22:13:06.153Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10345
File: src/components/Resource/ResourceDetailsUpdate.tsx:132-145
Timestamp: 2025-01-31T22:13:06.153Z
Learning: The migration from useTanStackQueryInstead to useQuery in React components requires:
1. Updating types to use UseQueryResult instead of custom hook return type
2. Replacing loading with isLoading property
3. Using queryKey array for cache management
4. Using queryFn with query utility function
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use `tanstack/react-query` for API state management in page components (existing dependency)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading, error, and success states for data fetching
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement loading, error, and success states for async operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Implement proper error handling using the global error handler for TanStack Query operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper loading states and error boundaries in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Handle loading, error, and success states consistently across all providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:20.837Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/typescript-types.instructions.md:0-0
Timestamp: 2025-11-25T13:53:20.837Z
Learning: Applies to src/types/**/*{Query,Result}*.{ts,tsx} : React Query integration types should export query result types with data, isLoading, error, and refetch properties for API operations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-08T07:49:59.494Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9748
File: src/pages/Organization/components/OrganizationFilter.tsx:0-0
Timestamp: 2025-01-08T07:49:59.494Z
Learning: The project implements global error handling for React Query errors, making local error handling in individual query hooks unnecessary.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-20T09:11:54.138Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9768
File: src/components/Resource/ResourcePage.tsx:80-89
Timestamp: 2025-01-20T09:11:54.138Z
Learning: In the care_fe project, useQuery and useMutation hooks have global error handlers. Additional error handlers should only be added when specific functionality is needed beyond the global handler. In such cases, prefer using built-in params like isSuccess and isError from useQuery/useMutation.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-02-04T12:39:49.688Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 10352
File: src/Providers/AuthUserProvider.tsx:47-63
Timestamp: 2025-02-04T12:39:49.688Z
Learning: The `onError` callback option was removed from `useQuery` in TanStack Query v5. Error handling should be done by checking the `error` state directly or using Error Boundaries.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use tanstack/react-query for server state management in API client code
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:33.081Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/providers.instructions.md:0-0
Timestamp: 2025-11-25T13:52:33.081Z
Learning: Applies to src/Providers/**/*.{ts,tsx} : Integrate with tanstack/react-query for server state management in providers
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Optimize CAREUI components for memory efficiency for long-running clinical applications
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:32.224Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/hooks.instructions.md:0-0
Timestamp: 2025-11-25T13:51:32.224Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : Use `useState` for local state and `tanstack/react-query` for server state in custom hooks
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Integrate CAREUI components cleanly with healthcare data sources and support live data updates for critical medical information
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{tsx,ts} : Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement memoization for expensive computations in utility functions
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-09T08:56:20.178Z
Learnt from: i0am0arunava
Repo: ohcnetwork/care_fe PR: 9801
File: src/pages/Organization/OrganizationFacilities.tsx:69-75
Timestamp: 2025-01-09T08:56:20.178Z
Learning: When using useDebouncedState with query parameters in TypeScript, ensure the debounced state maintains the same type as the original state (QueryParam). Avoid splitting into separate string states as it breaks type safety.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useMutation` hook with `mutationFn` parameter wrapping API routes with the `mutate()` utility, and implement `onSuccess` callbacks to invalidate related queries
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:35.875Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/04-ui-components.mdc:0-0
Timestamp: 2025-11-25T13:54:35.875Z
Learning: Applies to **/*.{tsx,ts} : Implement proper ARIA attributes for accessibility
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Add ARIA labels for critical medical data (patient names, vital signs, medication alerts)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Use proper ARIA labels and roles in page components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement comprehensive screen reader support - All medical data must be accessible via assistive technology with proper ARIA labels for medical context and urgency
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/components/**/*.{ts,tsx} : Implement WCAG 2.1 AA accessibility compliance in medical applications with screen reader compatibility and keyboard navigation
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Maintain proper heading hierarchy for screen reader support in medical records display
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:52:51.914Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/react-components.instructions.md:0-0
Timestamp: 2025-11-25T13:52:51.914Z
Learning: Applies to src/components/**/*.{ts,tsx} : Ensure keyboard navigation is supported for clinical workflows and emergency situations
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement robust error handling with user-friendly medical context in CAREUI components
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:46.407Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/careui.instructions.md:0-0
Timestamp: 2025-11-25T13:50:46.407Z
Learning: Applies to src/CAREUI/**/*.{ts,tsx} : Implement proper error boundaries in CAREUI components for critical medical data handling
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-05T19:05:40.922Z
Learnt from: pratyush07-hub
Repo: ohcnetwork/care_fe PR: 14651
File: src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx:252-257
Timestamp: 2025-12-05T19:05:40.922Z
Learning: In healthcare components handling discharge status (like EncounterQuestion.tsx), maintainers implement defense-in-depth by adding early-return guards in change handlers (e.g., `if (isDischarged) return;`) even when the UI control is also disabled, to ensure business-critical immutability rules are enforced at multiple layers and protect against edge cases like browser extensions or unexpected UI library behavior.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:51:41.208Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/lib.instructions.md:0-0
Timestamp: 2025-11-25T13:51:41.208Z
Learning: Applies to src/lib/**/*.{ts,tsx} : Implement proper error recovery for critical systems
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:50:10.786Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T13:50:10.786Z
Learning: Applies to src/**/*.{ts,tsx} : Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use TanStack Query with the `query` and `mutate` utilities from `@/Utils/request/`
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-01-03T16:26:08.045Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9708
File: src/components/Users/UserResetPassword.tsx:72-89
Timestamp: 2025-01-03T16:26:08.045Z
Learning: When using react-query’s mutate, avoid chaining the calls as "() => mutate(...)(...)" and just call "mutate(...)" directly, relying on its built-in error handling and the global notification dispatcher.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Use `useQuery` hook with `queryKey` and `queryFn` parameters, where `queryFn` wraps the API route with the `query()` utility
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-17T19:47:58.152Z
Learnt from: AdityaJ2305
Repo: ohcnetwork/care_fe PR: 14821
File: src/components/Location/LocationNavigation.tsx:161-163
Timestamp: 2025-12-17T19:47:58.152Z
Learning: To ensure the remove-unused-i18n.js cleanup script detects i18n keys, avoid wrapping keys inside a ternary expression passed directly to t(). Instead, call t() separately in each branch of a conditional, e.g. condition ? t("key1") : t("key2"), or compute the key in a variable before passing to t(). For LocationNavigation.tsx (and similar TSX files in the repo), prefer explicit separate i18n calls per branch or a shared precomputed key to guarantee all keys are statically detectable by the script.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
📚 Learning: 2025-12-22T10:16:36.690Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 14804
File: src/pages/Facility/services/pharmacy/DispensesView.tsx:117-135
Timestamp: 2025-12-22T10:16:36.690Z
Learning: In the care_fe repository, prefer the native HTML title attribute for simple tooltips over using shadcn/ui Tooltip components. Use Tooltip components only when the tooltip requires richer content, interactivity, or accessibility enhancements that cannot be achieved with a plain title. For simple cases, add a title attribute to the element (e.g., <span title="...">). If a Tooltip is used, ensure it is accessible and necessary, and avoid duplicating content available in the title attribute.
Applied to files:
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Redirect rules - care-ohc
- GitHub Check: Header rules - care-ohc
- GitHub Check: Pages changed - care-ohc
- GitHub Check: Test
- GitHub Check: CodeQL-Build
- GitHub Check: OSSAR-Scan
- GitHub Check: deploy-preview
🔇 Additional comments (7)
src/pages/Facility/services/inventory/externalSupply/requestOrder/RequestOrderShow.tsx (7)
1-9: LGTM!Imports are correctly structured and necessary for the new parallel queries implementation with
useQueriesand memoization.
66-72: LGTM!Interface correctly updated to accept
deliveryOrderIds: string[]instead of a single request order ID, enabling the fix for fetching all delivery items.
142-182: LGTM!Render logic is well-structured with:
- Proper ARIA attributes (
role="alert",aria-live="assertive") for accessibility- Appropriate handling of full error, partial error (warning), loading, and empty states
- All UI strings using i18n translation keys as required
250-258: LGTM!Memoization is correctly implemented to prevent unnecessary re-renders:
deliveryOrdersmemoized from query resultsdeliveryOrderIdsderived and memoized fromdeliveryOrdersThis ensures
AllSupplyDeliveriesComponentdoesn't re-fetch when the parent re-renders with the same data.
814-820: LGTM!Component correctly passes the memoized
deliveryOrderIdsarray toAllSupplyDeliveriesComponent, implementing the fix for fetching all delivery items regardless of their original request linkage.
294-323: Clarification: Dual query pattern is intentional.The existing
allSupplyDeliveriesquery (filtering byrequest_order) is retained for calculating dispatched quantities in the "requested-items" tab. This is separate fromAllSupplyDeliveriesComponentwhich now fetches bydeliveryOrderIdsto include extra items in the "items-summary" tab.This dual approach correctly serves different use cases:
- Requested Items tab: Shows supply requests matched against deliveries linked to the request order
- Items Summary tab: Shows all delivered items including extras added directly to delivery orders
94-140: Well-structured parallel queries with proper deduplication.The
useQueriesimplementation with thecombinefunction correctly:
- Executes parallel queries per delivery order ID
- Deduplicates results in O(n) using a Set
- Aggregates loading/error states appropriately
The
orderquery parameter is correct for thelistSupplyDeliveryendpoint. The API definition shows this endpoint acceptsorderas a query parameter (distinct from thedeliveryOrdersendpoint which usesrequest_order).The
enabledcondition on line 115 is redundant sinceuseQuerieswon't create queries ifdeliveryOrderIdsis empty, but it doesn't cause any issues.
Proposed Changes
Fixes #14955
Description
The "Received Items Summary" tab in the Request Order view was previously filtering items based on the request_order ID. This excluded "extra" items added to a delivery that were not part of the original supply request (and thus lacked the direct link to the request order).
This PR updates the fetching logic to retrieval items from all Delivery Orders associated with the Request Order, ensuring that unrequested/extra items are properly displayed.
Changes:
Tagging: @ohcnetwork/care-fe-code-reviewers
Screenshots:
Screen.Recording.2025-12-28.at.1.21.43.AM.mov
Merge Checklist
Summary by CodeRabbit
Refactor
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.