Custom Renderer Props Undefined

Hi I am still having issues with props coming back undefined in custom renderers.
For example this is a custom renderer I am working on and I have imported the custom renderer appropriately, but options is coming back undefined.

import React, { useMemo } from ‘react’;
import PropTypes from ‘prop-types’;
import { MenuItem, Select } from ‘@mui/material’;
import merge from ‘lodash/merge’;

export const i18nDefaults = {
‘enum.none’: ‘None’
};

export const MuiSelect = ({ data, className, id, enabled, schema, uischema, path, handleChange, options, config, t }) => {
const appliedUiSchemaOptions = merge({}, config, uischema.options);
const noneOptionLabel = useMemo(
() => t(‘enum.none’, i18nDefaults[‘enum.none’], { schema, uischema, path }),
[t, schema, uischema, path]
);

{
console.log(options);
}

return (
<Select
className={className}
id={id}
disabled={!enabled}
autoFocus={appliedUiSchemaOptions.focus}
value={data !== undefined ? data : ‘’}
onChange={ev => handleChange(path, ev.target.value || undefined)}
fullWidth={true}
variant={‘standard’}>
{[
<MenuItem value={‘’} key=“jsonforms.enum.none”>
{noneOptionLabel}

].concat(
options.map(optionValue => (

{optionValue.label}

))
)}

);
};

MuiSelect.propTypes = {
options: PropTypes.arrayOf(PropTypes.any),
className: PropTypes.any,
id: PropTypes.any,
enabled: PropTypes.any,
schema: PropTypes.any,
uischema: PropTypes.any,
path: PropTypes.any,
handleChange: PropTypes.any,
config: PropTypes.any,
t: PropTypes.any,
data: PropTypes.any
};

Hi @avwchapman ,
for material renderers, the properties are injected via higher order components that calculate the props from the state. I do not see this in your pasted code. Could that be the issue.
See here how this is done for the built in enum control: https://github.com/eclipsesource/jsonforms/blob/28eeeca537ef1a38e44de12cd9e6f5d5632cb913/packages/material-renderers/src/controls/MaterialEnumControl.tsx#L65-L67

Best regards,
Lucas

I have that here in the enum cell:

import React from ‘react’;

import { isEnumControl, rankWith } from ‘@jsonforms/core’;

import { withJsonFormsEnumCellProps, withTranslateProps } from ‘@jsonforms/react’;

import { MuiSelect } from ‘./multiSelect’;

export const MaterialEnumCell = props => <MuiSelect {…props} />;

/**

  • Default tester for enum controls.

  • @type {RankedTester}

*/

export const materialEnumCellTester = rankWith(3, isEnumControl);

// HOC order can be reversed with Improve React HOC types · Issue #1987 · eclipsesource/jsonforms · GitHub

export default withJsonFormsEnumCellProps(withTranslateProps(React.memo(MaterialEnumCell)), false);

Hi @avwchapman ,
I’m a little bit confused: Are you trying to implement and register a cell for a table or a custom renderer?
In case of a renderer, can you try using the HOC withJsonFormsEnumProps. You seem to use withJsonFormsEnumCellProps at the moment.

I am trying to create a custom renderer to handle multi select

I see. In that case you can have a look at MaterialEnumArrayRenderer. It uses the HOC withJsonFormsMultiEnumProps