[6.x] Filter out undefined values for preview texts for sets
#13246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Statamic 6 Alpha 18 introduced a JS error for a site that was operational in Alpha 17.
This is the error from the Alpha 18 build:
Here is the error from the dev build:
Tracing this through, when the Preview Text in the
replicator/Set.vuefile is being generated, somevalueprops at the map wereundefinedand not a proxy.This lead to an undefined value being passed through to the
replaceAllglobal helper.This PR adds
undefinedto the filter step of the preview generation to prevent this error.I have a private repo I can share if you want the source Blueprints and Fieldsets that are triggering the error, and is triggering on the dev build when adding a Replicator set to the page (and on the 'prod' build, when loading a page that was saved)
Not sure if this the best approach - and what was added between 17 and 18 that caused this to start. Not sure if something in #13113 added this?