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

Check existence of computed value before display #416

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gmooren
Copy link

@gmooren gmooren commented Oct 4, 2023

There is an issue which became present in Laravel Nova v4 when using single media collections. When a record does not have a media collection as defined in the Files field, it will result in the following frontend error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'file_name')
    at Proxy.<anonymous> (media-lib-images-field:2:43292)
    at renderComponentRoot (runtime-core.esm-bundler.js:816:1)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5701:1)
    at ReactiveEffect.run (reactivity.esm-bundler.js:178:1)
    at instance.update (runtime-core.esm-bundler.js:5814:1)
    at setupRenderEffect (runtime-core.esm-bundler.js:5822:1)
    at mountComponent (runtime-core.esm-bundler.js:5612:1)
    at processComponent (runtime-core.esm-bundler.js:5565:1)
    at patch (runtime-core.esm-bundler.js:5040:1)
    at mountChildren (runtime-core.esm-bundler.js:5284:1)

This is caused by the value attribute in the API response being an empty array. In Nova 4 the error will stop the table drawing process. In Nova 3 the same error is present but the table drawing just continues.

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.

1 participant