mirror of https://github.com/linkerd/linkerd2.git
Wrap withREST in context for api reference (#1036)
As part of the HOC + Context merges, ResourceList missed out on the api injection and errors out on the Namespaces tab. Wrap the returned HOC in `withContext` to make sure it is there, no matter where it is in the tree. (Fixes #1034)
This commit is contained in:
parent
b3170af567
commit
6386b832a6
|
@ -1,5 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { withContext } from './AppContext.jsx';
|
||||
|
||||
/**
|
||||
* Provides components with data fetched via. polling a list of REST URLs.
|
||||
|
@ -9,7 +10,7 @@ import React from 'react';
|
|||
* @param {List[string]} resetProps - Props that on change cause a state reset.
|
||||
*/
|
||||
const withREST = (WrappedComponent, componentPromises, resetProps = []) => {
|
||||
return class extends React.Component {
|
||||
class RESTWrapper extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.api = this.props.api;
|
||||
|
@ -95,7 +96,9 @@ const withREST = (WrappedComponent, componentPromises, resetProps = []) => {
|
|||
{...this.props} />
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return withContext(RESTWrapper);
|
||||
};
|
||||
|
||||
export default withREST;
|
||||
|
|
Loading…
Reference in New Issue