Skip to content

[5.4] Fix duplicate getLayoutData execution in mod_tags_popular#46827

Merged
muhme merged 2 commits intojoomla:5.4-devfrom
sathwikre:fix-mod-tags-popular-getlayoutdata
Feb 5, 2026
Merged

[5.4] Fix duplicate getLayoutData execution in mod_tags_popular#46827
muhme merged 2 commits intojoomla:5.4-devfrom
sathwikre:fix-mod-tags-popular-getlayoutdata

Conversation

@sathwikre
Copy link
Copy Markdown
Contributor

The popular tags module executes getLayoutData() twice due to an
overridden dispatch() method.

This change removes the custom dispatch() override and moves the
render-stop logic into getLayoutData(), preventing duplicate execution
and unnecessary queries.

Fixes #46816

@joomdonation
Copy link
Copy Markdown
Contributor

@sathwikre Your fix looks good. However, the change in the two files build/build.php and components/com_contact/tmpl/contact/default_form.php should not be included in this PR. Could you please check?

@sathwikre sathwikre force-pushed the fix-mod-tags-popular-getlayoutdata branch from 5eddef6 to cadaef4 Compare February 4, 2026 02:14
@sathwikre
Copy link
Copy Markdown
Contributor Author

@joomdonation

Thanks for checking.

You’re right — those changes were unrelated. I’ve cleaned up the branch so
this PR now only contains the fix for mod_tags_popular.

@joomdonation
Copy link
Copy Markdown
Contributor

@sathwikre There is still an unrelated file build/build.php. You can check it here https://github.com/joomla/joomla-cms/pull/46827/changes

@sathwikre sathwikre force-pushed the fix-mod-tags-popular-getlayoutdata branch from 0361fa2 to eb89f3b Compare February 4, 2026 02:35
@sathwikre
Copy link
Copy Markdown
Contributor Author

Thanks for pointing that out.

You’re right — the branch still contained unrelated changes due to an
accidental merge earlier. I’ve now reset the branch and reapplied only the
mod_tags_popular fix, so the PR contains a single relevant file change.

@joomdonation
Copy link
Copy Markdown
Contributor

That's not right. The change to the file build/build.php is still there. You can check it yourself https://github.com/joomla/joomla-cms/pull/46827/changes

@sathwikre sathwikre force-pushed the fix-mod-tags-popular-getlayoutdata branch from eb89f3b to 0396a32 Compare February 4, 2026 02:47
@sathwikre
Copy link
Copy Markdown
Contributor Author

@joomdonation

Thanks for your patience — you were right.

I had been resetting the branch against my fork instead of the upstream
joomla/5.4-dev branch. I’ve now reset against upstream and reapplied only
the mod_tags_popular fix.

The PR now contains a single relevant file change.

@joomdonation
Copy link
Copy Markdown
Contributor

Yes, looks good now. Thanks !

@richard67
Copy link
Copy Markdown
Member

@sathwikre When creating a pull request you should always check the result on GitHub, not only in your IDE. Depending on your editor settings, if it shows white space (spaces and tabs) or not, you might not see code style issues in the IDE, and also unwanted changes can be avoided when checking the PR on GitHub.

@richard67
Copy link
Copy Markdown
Member

@sathwikre P.S.: And you should stick with our pull request template and not remove all these things from it. You PR is missing testing instructions. I am pretty sure I've already told you elsewhere in some other PR.

@richard67
Copy link
Copy Markdown
Member

@joomdonation Is it right that the method modified by this PR now returns false in some case? It did not do that before. Technically it could even be considered a b/c break. It needs to check where that method is called to see if false is ok or if it should be null or an empty array. Maybe you can advise?

@joomdonation
Copy link
Copy Markdown
Contributor

@richard67 The PR is fine. Return false will prevent the module from being rendered, see https://github.com/joomla/joomla-cms/blob/5.4-dev/libraries/src/Dispatcher/AbstractModuleDispatcher.php#L66

@richard67
Copy link
Copy Markdown
Member

@richard67 The PR is fine. Return false will prevent the module from being rendered, see https://github.com/joomla/joomla-cms/blob/5.4-dev/libraries/src/Dispatcher/AbstractModuleDispatcher.php#L66

@joomdonation I see. Thanks for checking.

@Denitz
Copy link
Copy Markdown
Contributor

Denitz commented Feb 4, 2026

I have tested this item ✅ successfully on 0396a32


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

@exlemor
Copy link
Copy Markdown

exlemor commented Feb 4, 2026

I have tested this item ✅ successfully on 0396a32

Hello @sahwikre, I have tested this successfully and was able to confirm that in Debug mode there is no longer a duplicate query for /modules/mod_tags_popular/src/Helper/TagsPopularHelper.php

I assume that this is distinct from the issue about Popular Tags module not reporting the correct number of tags.


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

@richard67
Copy link
Copy Markdown
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 4, 2026
@muhme
Copy link
Copy Markdown
Contributor

muhme commented Feb 5, 2026

✅ Final test before merge using JBT

  • Before PR, created and placed 'Tags - Popular' site module
    • Seen 17 statements were executed, 2 of which were duplicates for rendering home, with SELECT ... FROM __contentitem_tag_map queries twice
  • Applied PR with Patch Tester
  • Only 16 statements were executed to render home, no duplicates anymore
  • 'Tags - Popular' is shown w/o tags and 'Show "No results"' text configured
  • Module is correct not shown without 'Show "No results"'
  • Created three tags and one article with the tree tags, 'Tags - Popular' shows the tags and still home needs only 16 statements
  • No unusual Joomla log messages

@muhme muhme merged commit 9ad2aa6 into joomla:5.4-dev Feb 5, 2026
130 of 137 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 5, 2026
@muhme muhme added this to the Joomla! 5.4.3 milestone Feb 5, 2026
@muhme
Copy link
Copy Markdown
Contributor

muhme commented Feb 5, 2026

Thank you @sathwikre for your contribution. Thank you @joomdonation and @richard67 for supporting this PR. Thank you @Denitz and @exlemor for testing.

sathwikre added a commit to sathwikre/joomla-cms that referenced this pull request Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[5.4] Modules run getLayoutData() twice

8 participants