? NPM Resource Changed bug PR-4.3-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
15 May 2023

Summary of Changes

After removing inline js we broke posibility to use these with dinamic content, eg content loaded with ajax.
Not used in core, but other developers may use it.

Testing Instructions

Apply patch, run npm install
Add to index.php of admin template (ajax simulator, will add "Reload" button on the page):

<script type="module">
  const btn = document.createElement('button');
  btn.type = 'button';
  btn.textContent = 'Reload';
  window.content.insertAdjacentElement('afterbegin', btn);
  btn.addEventListener('click', () => {
      fetch('index.php?option=com_content&view=articles&tmpl=component').then((resp) => resp.text()).then((resp) => {
        const temp = document.createElement('template');
        temp.innerHTML = resp;
        const container = window.adminForm.parentElement;
        container.removeChild(window.adminForm);
        container.appendChild(temp.content.querySelector('#adminForm'));
        container.dispatchEvent(new CustomEvent('joomla:updated', {bubbles: true, cancelable: true}));
      })
  });
</script>

Go to Articles view:
Click unpublish/publish;
Click "Reload" button;
Click unpublish/publish again;

Actual result BEFORE applying this Pull Request

First click "unpublish/publish" works
Second click "unpublish/publish" does not works

Expected result AFTER applying this Pull Request

First click "unpublish/publish" works
Second click "unpublish/publish" works

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed
avatar joomla-cms-bot joomla-cms-bot - change - 15 May 2023
Category JavaScript Repository NPM Change
avatar Fedik Fedik - open - 15 May 2023
avatar Fedik Fedik - change - 15 May 2023
Status New Pending
avatar Fedik Fedik - change - 15 May 2023
The description was changed
avatar Fedik Fedik - edited - 15 May 2023
avatar Fedik Fedik - change - 15 May 2023
Labels Added: NPM Resource Changed bug PR-4.3-dev
avatar dgrammatiko
dgrammatiko - comment - 15 May 2023

@Fedik I didn't thought that these could be in a dynamically generated content. Good catch

avatar dgrammatiko dgrammatiko - test_item - 15 May 2023 - Tested successfully
avatar dgrammatiko
dgrammatiko - comment - 15 May 2023

I have tested this item successfully on 264b13d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40598.

avatar richard67 richard67 - alter_testresult - 16 May 2023 - dgrammatiko: Tested successfully
avatar JonasAtZwetschke JonasAtZwetschke - test_item - 16 May 2023 - Tested successfully
avatar JonasAtZwetschke
JonasAtZwetschke - comment - 16 May 2023

I have tested this item successfully on fd33542


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40598.

avatar richard67 richard67 - change - 18 May 2023
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 18 May 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40598.

avatar obuisard obuisard - change - 18 May 2023
Labels Added: ?
avatar obuisard obuisard - close - 18 May 2023
avatar obuisard obuisard - merge - 18 May 2023
avatar obuisard obuisard - change - 18 May 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-05-18 14:49:59
Closed_By obuisard
avatar obuisard
obuisard - comment - 18 May 2023

Thank you Fedir @Fedik, great catch :-)

Add a Comment

Login with GitHub to post a comment