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

fix(ui): safely accesses field in default filter component #9276

Conversation

akhrarovsaid
Copy link
Contributor

@akhrarovsaid akhrarovsaid commented Nov 17, 2024

What?

In the WhereBuilder Condition DefaultFilter component, there is a switch statement that contains components to return based on the built filter in the admin ui. Having a filter built out then navigating to another collection list view causes an error to occur due to InternalField being undefined but the DefaultFilter tries to access the field on it.

Why?

To fix unexpected cannot access property field of undefined errors.

How?

Adding a conditional chaining operator.

Odd thing here is that the Text component where this error originates from doesn't actually make use of the passed InternalField. Might be worth it to take a closer look at it.

Fixes #9179

@jacobsfletch jacobsfletch changed the title fix(ui): fix wherebuilder text accessing field on undefined internalfield fix(ui): safely accesses field in default filter component Nov 18, 2024
@jacobsfletch jacobsfletch merged commit 1a31e63 into payloadcms:main Nov 18, 2024
61 of 64 checks passed
Copy link

🚀 This is included in version v3.0.0-beta.135

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

Successfully merging this pull request may close these issues.

Navigation from filtered collection views causes "Cannot read properties of undefined (reading 'field')" error
2 participants