File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/elements/common/api-context Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,19 @@ import APIContext from './APIContext';
88
99export interface WithAPIProps {
1010 api ?: API | null ;
11- [ key : string ] : unknown ;
1211}
1312
14- const withAPIContext = < P extends WithAPIProps , T = unknown > ( WrappedComponent : React . ComponentType < P > ) => {
15- return React . forwardRef < T , Omit < P , 'api' > > ( ( props , ref ) => (
16- < APIContext . Consumer > { api => < WrappedComponent ref = { ref } { ...( props as P ) } api = { api } /> } </ APIContext . Consumer >
13+ /**
14+ * Higher-order component that provides API context to the wrapped component
15+ * This HOC is used by many components throughout the codebase
16+ */
17+ const withAPIContext = (
18+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19+ WrappedComponent : React . ComponentType < any > ,
20+ ) => {
21+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22+ return React . forwardRef < any , any > ( ( props , ref ) => (
23+ < APIContext . Consumer > { api => < WrappedComponent ref = { ref } { ...props } api = { api } /> } </ APIContext . Consumer >
1724 ) ) ;
1825} ;
1926
You can’t perform that action at this time.
0 commit comments