Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using renderField in version 6.4 #996

Open
omerfaran opened this issue Oct 26, 2023 · 3 comments
Open

Using renderField in version 6.4 #996

omerfaran opened this issue Oct 26, 2023 · 3 comments

Comments

@omerfaran
Copy link

Describe the bug
Hello!

I migrated from react-awesome-query-builder version 5.4 to:
"@react-awesome-query-builder/mui": "^6.4.2"

In my code I'm customizing the config:


import { MuiConfig, BasicConfig } from '@react-awesome-query-builder/mui';

    const _customConfigWithTheme: BasicConfig = {
      ...MuiConfig,
      settings: {
        ...MuiConfig.settings,
        renderField: (props) => (
          <WithTheme theme={theme}>
            {
              MuiConfig.settings.renderField?.(props) // THIS LINE THROWS THE ERROR
            }
          </WithTheme>
        ),

That worked fine without any issues in version 5.4, but in version 6.4, I'm getting the error:

Uncaught TypeError: Cannot read properties of undefined (reading 'RCE')

The error is emerging from the line MuiConfig.settings.renderField?.(props), where I added the comment.

To Reproduce
Create a config with the above data

Expected behavior
Should not throw

Thanks a lot in advance

@ukrbublik
Copy link
Owner

In renderField you should pass 2nd param: MuiConfig.ctx

If this works for you, please don't close the issue, I should mention this in readme

@ukrbublik
Copy link
Owner

@omerfaran
Does this change fix your issue?

              MuiConfig.settings.renderField?.(props, MuiConfig.ctx) // THIS LINE THROWS THE ERROR

@omerfaran
Copy link
Author

@omerfaran Does this change fix your issue?

              MuiConfig.settings.renderField?.(props, MuiConfig.ctx) // THIS LINE THROWS THE ERROR

Yes, thank you very much!
Keeping open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants