[sitecore-jss] Bugfix to prevent error: Cannot use ‘in’ operator to search for ‘editable’ in '' #1767
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.
Description / Motivation
When working with page templates, designs, and instances within our DXP, it's essential to ensure smooth functionality and error-free operation. One recurring issue that has been identified is the error message "Cannot use the 'in' operator to search for 'editable' in [SOME-GUIDS]." This error occurs in a specific sequence of actions, including creating page templates, designs, instances, and overriding designs in the content editor.
The steps to reproduce the issue are straightforward: first, a page template is created, followed by the design of the page. Then, an instance of the page is generated, and its design is overridden from the dropdown in the content editor. Lastly, a page is selected from a multilist, which has had its design overridden. It's at this point that the error message appears.
Upon further investigation, it has been observed that the structure of Partial Designs does not align with the expected format. Instead of the {value, editable} structure, the Partial Designs exhibit a different format, which could potentially lead to the encountered error.
This approach delegates the decision to exclude "Page Designs" from traverseField to you, the expert in charge. By evaluating the impact and relevance of excluding this element, you can determine whether it aligns with jss requirements and objectives. This decision-making process ensures that we implement solutions that not only resolve the immediate issue but also uphold the integrity and functionality of Sitecore.
Testing Details
To reproduce the issue "Cannot use the 'in' operator to search for 'editable' in [SOME PARTIAL DESIGNS IDs]," follow these steps:
Upon completing these steps, you may encounter the error message. This issue could be due to the structure of Partial Designs, which should ideally follow the {
value
,editable
} structure instead of the provided structure:The solution is to validate if field is type of string then were are on this scenario.
Types of changes