diff --git a/lib/ControlledVocab/ControlledVocab.js b/lib/ControlledVocab/ControlledVocab.js index d0da7463e..9369e3776 100644 --- a/lib/ControlledVocab/ControlledVocab.js +++ b/lib/ControlledVocab/ControlledVocab.js @@ -21,6 +21,15 @@ import EditableList from '../EditableList'; import css from './ControlledVocab.css'; import makeRefdataActuatorsBoundTo from './actuators-refdata'; +const getTenantFromRESTResource = (queryParams, pathComponents, resourceValues, logger, props) => { + const { + tenant, + stripes, + } = props; + + return tenant || stripes.okapi.tenant; +}; + class ControlledVocab extends React.Component { static manifest = Object.freeze({ values: { @@ -28,7 +37,7 @@ class ControlledVocab extends React.Component { path: '!{baseUrl}', records: '!{records}', throwErrors: false, - tenant: '%{tenant}', + tenant: getTenantFromRESTResource, clientGeneratePk: '!{clientGeneratePk}', PUT: { path: '!{baseUrl}/%{activeRecord.id}', @@ -55,7 +64,7 @@ class ControlledVocab extends React.Component { type: 'okapi', records: 'users', path: 'users', - tenant: '%{tenant}', + tenant: getTenantFromRESTResource, GET: { params: { query: (queryParams, pathComponents, resourceValues) => { @@ -68,7 +77,6 @@ class ControlledVocab extends React.Component { } }, updaterIds: {}, - tenant: {}, }); static propTypes = { @@ -245,16 +253,6 @@ class ControlledVocab extends React.Component { return null; } - componentDidMount() { - const { - mutator, - tenant, - stripes, - } = this.props; - - mutator.tenant.replace(tenant || stripes.okapi.tenant); - } - componentDidUpdate() { // build a list of the ids of users who have updated CV items so // we can look them up all at once