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 finding child content-type elements in stage-builder #869

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

orukusaki
Copy link

@orukusaki orukusaki commented May 2, 2024

Description (*)

Fixes a bug whereby child content-type elements will not be found, where other types of elements also exist at the same level.

Manual testing scenarios (*)

  1. Create a content type, where child content elements are mixed in with other elements. For example:
    master.html:
<div data-bind="attr: data.main.attributes, style: data.main.style">
    <div class="swiper">
        <ul class="swiper-wrapper" each="contentType.getChildren()">
            <li class="swiper-slide">
                <render args="{ name: content.template, data: content }"></render>
            </li>
        </ul>
        <div class="swiper-scrollbar"></div>
    </div>
</div>

preview.html:

<div data-bind="attr: data.main.attributes, style: data.main.style"
     event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
    <render args="getOptions().template"></render>
    <div class="swiper">
        <ul class="swiper-wrapper element-children content-type-container"
            each="contentType.getChildren()" css="getChildrenCss()" attr="{id: contentType.id + '-children'}"
            data-bind="sortable: getSortableOptions()"
            afterRender="function (element) { if (typeof afterChildrenRender === 'function') { afterChildrenRender(element); } }">
            <li class="pagebuilder-content-type-wrapper swiper-slide">
                <if args="$parent.isContainer()">
                    <div class="pagebuilder-drop-indicator"></div>
                </if>
                <div
                    template="{ name: preview.template, data: preview, afterRender: function () { preview.dispatchAfterRenderEvent.apply(preview, arguments); } }"
                    attr="{ id: id }" css="{'pagebuilder-content-type-hidden': !preview.display()}">
                </div>
                <if args="$parent.isContainer() && $index() === $parent.contentType.getChildren()().length - 1">
                    <div class="pagebuilder-drop-indicator"></div>
                </if>
            </li>
        </ul>
        <div class="swiper-scrollbar"></div>
    </div>
</div>

It is possible to create this content type in Pagebuilder, and the correct result is rendered into the database and on the frontend. However, Pagebuilder cannot then load up the content back into the stage - the presence of the <li> element causes only the last item to be found, and <div class="swiper-scrollbar"> causes even that to be forgotten.

This small fix corrects this, and all types of content can now be loaded into the stage correctly.

Checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Fix finding child content-type elements in stage-builder #875: Fix finding child content-type elements in stage-builder

@engcom-Bravo engcom-Bravo added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Sep 13, 2024
@engcom-Hotel engcom-Hotel added the Project: Community Picked PRs upvoted by the community label Sep 13, 2024
@engcom-Hotel
Copy link
Collaborator

@magento run all tests

@engcom-Hotel
Copy link
Collaborator

@magento create issue

@engcom-Hotel
Copy link
Collaborator

Hello @orukusaki,

❌ QA not Passed

We have tried reproducing the issue by following the Manual Testing Scenarios mentioned above. But it seems for us the issue is not reproducible.

Please refer to the below custom module we have made to reproduce the issue:
Magz.zip

Please let us know if we missed anything.

Thanks

@engcom-Hotel
Copy link
Collaborator

Hello @orukusaki,

We are still waiting for your reply on this PR.

Thanks

@orukusaki
Copy link
Author

Hi,
I've attached a more complete example module, which you can use to see the issue.
Prpb869-updated.zip
When you first add the new content-type, you can add images to it as child items. They save correctly, and can be viewed on the frontend site, but the page then does not load up correctly into the Pagebuilder Preview.
With the fix in place, loading the saved content works fine
thanks

@engcom-Hotel
Copy link
Collaborator

@magento run all tests

@engcom-Hotel
Copy link
Collaborator

Hello @orukusaki,

Thanks for the update on this PR!

✔️ QA Passed

Manual testing scenario:

  1. Create a content type, where child content elements are mixed in with other elements
  2. It is possible to create this content type in Pagebuilder, and the correct result is rendered into the database and on the frontend. However, Pagebuilder cannot then load up the content back into the stage - the presence of the <li> element causes only the last item to be found, and
    causes even that to be forgotten.

After: ✔️
image

Before: ✖️
image

Tested all the manual scenarios, no impact on regression testing.

Meanwhile the tests are running on this PR, moving it to Extended testing.

Thanks

@engcom-Hotel
Copy link
Collaborator

@magento run Functional Tests CE, Functional Tests EE, Functional Tests B2B, Performance Acceptance Tests

@engcom-Hotel
Copy link
Collaborator

@magento run Functional Tests B2B

@engcom-Hotel
Copy link
Collaborator

Failed tests seem flaky to me. The failures are different in last 2 builds. Please refer to the below screenshots:

Failure 1

image

Failure 2
image

Hence moving the PR to Merge in progress.

Thanks

@engcom-Hotel
Copy link
Collaborator

@magento run Functional Tests B2B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Progress: accept Project: Community Picked PRs upvoted by the community Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Status: Merge in Progress
Development

Successfully merging this pull request may close these issues.

[Issue] Fix finding child content-type elements in stage-builder
3 participants