File tree Expand file tree Collapse file tree 7 files changed +27
-8
lines changed Expand file tree Collapse file tree 7 files changed +27
-8
lines changed Original file line number Diff line number Diff line change 1414 "source.addMissingImports.ts" : " explicit" ,
1515 "source.organizeImports" : " never" ,
1616 "source.organizeLinkDefinitions" : " explicit" ,
17- "source.removeUnused.ts" : " explicit " ,
17+ "source.removeUnused.ts" : " never " ,
1818 "source.removeUnusedImports" : " explicit" ,
1919 "source.sortImports" : " never"
2020 },
Original file line number Diff line number Diff line change 11/* eslint-disable import-x/no-namespace */
2- import { DependencyInjection } from "@clean-architecture/shared-kernel" ;
32import * as Catalog from "@clean-architecture/catalog" ;
43
54export const Main = ( ) => {
65 return (
7- < DependencyInjection entityGateway = { new Catalog . QuoteEntityGateway ( ) } >
6+ < Catalog . DependencyInjection >
87 < Catalog . GetQuoteView />
9- </ DependencyInjection >
8+ </ Catalog . DependencyInjection >
109 ) ;
1110} ;
Original file line number Diff line number Diff line change 4242 "vitest" : " 2.1.8"
4343 },
4444 "peerDependencies" : {
45+ "@clean-architecture/shared-kernel" : " ^0.0.0" ,
4546 "react" : " ^18.0.0 || ^19.0.0"
4647 }
4748}
Original file line number Diff line number Diff line change 11import { useEffect , useMemo , useState } from "react" ;
2- import { useDependencyInjection } from "@clean-architecture/shared-kernel" ;
32import type { Hook } from "@clean-architecture/shared-kernel" ;
43
54import { GetQuoteUseCase } from "../useCases/GetQuoteUseCase" ;
65import type { GetQuoteViewModel } from "../adapters/GetQuoteViewModel" ;
76import { GetQuotePresenter } from "../adapters/GetQuotePresenter" ;
87import { GetQuoteController } from "../adapters/GetQuoteController" ;
9- import type { QuoteEntityGateway } from "../../Quote " ;
8+ import { useDependencyInjection } from "../../shared/frameworks/DependencyInjection " ;
109
1110export const GetQuoteView = ( ) => {
1211 const { controller, viewModel } = useGetQuote ( ) ;
@@ -31,7 +30,7 @@ export const GetQuoteView = () => {
3130} ;
3231
3332const useGetQuote : Hook < GetQuoteController , GetQuoteViewModel > = ( ) => {
34- const { entityGateway } = useDependencyInjection < QuoteEntityGateway > ( ) ;
33+ const { entityGateway } = useDependencyInjection ( ) ;
3534 const [ viewModel , setViewModel ] = useState < GetQuoteViewModel > ( { } ) ;
3635 const presenter = useMemo ( ( ) => new GetQuotePresenter ( setViewModel ) , [ ] ) ;
3736
Original file line number Diff line number Diff line change 11export { GetQuoteView } from "./GetQuote" ;
2- export { QuoteEntityGateway } from "./Quote " ;
2+ export { DependencyInjection } from "./shared/frameworks/DependencyInjection " ;
Original file line number Diff line number Diff line change 1+ import type { PropsWithChildren } from "react" ;
2+ import {
3+ DependencyInjection as SharedDependencyInjection ,
4+ useDependencyInjection as useSharedDependencyInjection ,
5+ } from "@clean-architecture/shared-kernel" ;
6+
7+ import { QuoteEntityGateway } from "../../Quote" ;
8+
9+ type DependencyInjectionProps = PropsWithChildren ;
10+
11+ export const DependencyInjection = ( { children } : DependencyInjectionProps ) => {
12+ return (
13+ < SharedDependencyInjection entityGateway = { new QuoteEntityGateway ( ) } >
14+ { children }
15+ </ SharedDependencyInjection >
16+ ) ;
17+ } ;
18+
19+ export const useDependencyInjection =
20+ useSharedDependencyInjection < QuoteEntityGateway > ;
You can’t perform that action at this time.
0 commit comments