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

Double digit Dynamic Placeholders are not rendered #1736

Closed
vishalthitegmail opened this issue Feb 13, 2024 · 3 comments
Closed

Double digit Dynamic Placeholders are not rendered #1736

vishalthitegmail opened this issue Feb 13, 2024 · 3 comments
Labels
backlog Issue/PR/discussion is reviewed and added to backlog for the further work 🐞 bug

Comments

@vishalthitegmail
Copy link

Describe the Bug

Hello team,
We are facing the challenge of generating a dynamic placeholder.
When the dynamic ID generates in double-digit we face an issue that no placeholder is recognized on the page.
The below code is generating a dynamic placeholder for me correctly with Next jS
<Placeholder name={accordioncolumn-${index + 1}-{*}} rendering={_rendering as ComponentRendering} />

However when index values get to double-digit placeholder does not get generated,

Below is the response from the layout service have the required placeholder.
image

To Reproduce

Create the placeholder in loop and pass the dynamic value of index more than 9

<Placeholder name={accordioncolumn-${index + 1}-{*}} rendering={_rendering as ComponentRendering} />

Expected Behavior

Placeholder with double-digit should also work and render the added renderings in placeholder
For example
<Placeholder name=accordioncolumn-10-{*} rendering={_rendering as ComponentRendering} />
<Placeholder name=accordioncolumn-11-{*} rendering={_rendering as ComponentRendering} />

Possible Fix

in this file https://github.com/Sitecore/jss/blob/dev/packages/sitecore-jss-react/src/components/PlaceholderCommon.tsx
Excluded params to handle double digits as well
image

Provide environment information

  • Sitecore Version: XM cloud
  • JSS Version: 21.5.0
  • Browser Name and version: Any browser
  • Operating System and version (desktop or mobile): NA
  • Link to your project (if available): NA
@SaintSkeeta
Copy link

Proposed Regex to allow for double digit numbers:-

const EXCLUDE_PLACEHOLDERS_RENDER = [
new RegExp(/column-(\d{1,2})-{*}/i),
new RegExp(/row-(\d{1,2})-{*}/i),
];

@illiakovalenko
Copy link
Contributor

illiakovalenko commented Feb 15, 2024

@vishalthitegmail Thanks for registering this issue! We are exploring this

@illiakovalenko illiakovalenko added the backlog Issue/PR/discussion is reviewed and added to backlog for the further work label Feb 15, 2024
@illiakovalenko
Copy link
Contributor

This issue is fixed in #1745

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Issue/PR/discussion is reviewed and added to backlog for the further work 🐞 bug
Projects
None yet
Development

No branches or pull requests

3 participants