Make WordPress Core

Opened 13 months ago

Last modified 4 hours ago

#62681 new defect (bug)

The theme count in Customizer > Change > WordPress.org Themes displays incorrect results

Reported by: ankitkumarshah's profile ankitkumarshah Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Customize Keywords: has-test-info has-patch has-screenshots
Focuses: Cc:

Description

When navigating to Customize > Change > WordPress.org Themes, selecting filters for theme search and then deselecting the filters immediately results in an incorrect theme count being displayed.

Steps to Reproduce:

  1. Go to Appearance > Customize > Change > WordPress.org Themes.
  1. Apply any filter to search for themes (e.g., Accessibility Ready, Block Editor Patterns, Block Editor Styles, etc).
  1. Deselect the applied filters instantly.
  1. Notice that the theme count displayed is incorrect.

https://i.postimg.cc/J7vXVFzD/image.png

Video:
https://utfs.io/f/TnWMEUzoUd855CZXZgBsSwYB9kjRr72FlZL3UcDuaPMOHhCG

Attachments (1)

62681.patch (1.3 KB) - added by parthvataliya 13 months ago.
This patch resolves the issue.

Download all attachments as: .zip

Change History (12)

#1 @usmandev000
13 months ago

This issue may be related to caching or a delayed refresh of the theme count. As a temporary workaround:

  1. After deselecting the filters, try refreshing the page to reset the theme count.
  2. Alternatively, navigate back to the previous section and return to the theme selector to force the count to update.

#2 follow-up: @usmandev000
13 months ago

Sometimes, incorrect functionality in the WordPress Customizer can be caused by plugin or theme conflicts. To rule out this possibility:

  1. Deactivate all plugins and switch to a default theme like Twenty Twenty-Three.
  2. Test the theme filter behavior again. If the issue persists, it’s likely a core WordPress bug. If the behavior changes, reactivate plugins one by one to identify the conflicting component.

#3 in reply to: ↑ 2 @usmandev000
13 months ago

Replying to usmandev000:

Sometimes, incorrect functionality in the WordPress Customizer can be caused by plugin or theme conflicts. To rule out this possibility:

  1. Deactivate all plugins and switch to a default theme like Twenty Twenty-Three.
  2. Test the theme filter behavior again. If the issue persists, it’s likely a core WordPress bug. If the behavior changes, reactivate plugins one by one to identify the conflicting component.

@ankitkumarshah try this, if the issue still persists, please let me know.

#4 @sainathpoojary
13 months ago

  • Keywords needs-patch has-testing-info added

Hey @ankitkumarshah,

I was able to reproduce the issue. Additionally, I tried the suggestions provided by @usmandev000, but the problem still persists. I also investigated further to identify the root cause and found that the issue is related to this section of the code but I wasn't able to discover the root cause.

#5 @parthvataliya
13 months ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.26
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.26)
  • Browser: Chrome 131.0.0.0
  • OS: Linux
  • Theme: Twenty Twenty-One 2.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

  • When we deselect an applied filter or select another filter instantly, this issue is reproduced because there is a condition, such as section.loading being true, in the initializeNewQuery, filtersChecked, and loadThemes functions. This indicates whether the theme section is fully loaded or not.
  • To address this, we could consider adding a loader when a filter is selected or deselected. However, this might frustrate end-users by making them wait to deselect a filter or select another option. If anyone has suggestions on how to handle this scenario more efficiently, please share your ideas.
Version 0, edited 13 months ago by parthvataliya (next)

@parthvataliya
13 months ago

This patch resolves the issue.

#6 @parthvataliya
13 months ago

  • Keywords needs-testing added

#7 @lumiblog
13 months ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.7.1
  • PHP: 8.2.23
  • Server: nginx/1.26.1
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.2.23)
  • Browser: Chrome 131.0.0.0
  • OS: Windows 10
  • Theme: Twenty Twenty-One 2.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (Reproduced).

Supplemental Artifacts

https://drive.google.com/file/d/1SCtSvqIMHL2OdJ5tz7wtzYlqsFpne13O/view

#8 @sainathpoojary
13 months ago

Hey @parthvataliya,

I’ve tested the patch for the reported issue, and it’s working well on my end. To provide further clarity, I’ve attached a demonstration video below showcasing the fix in action.

Video: https://utfs.io/f/PL8E4NiPUWyOoSlhSjgRVfkrM3cxj5whHLEvyNZCb2PpWuod

#9 @wordpressdotorg
8 months ago

  • Keywords has-test-info added; has-testing-info removed

#10 @r1k0
4 days ago

  • Keywords has-patch added; needs-patch removed

#11 @ozgursar
4 hours ago

  • Keywords has-screenshots added; needs-testing removed

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/62681/62681.patch

Environment

  • WordPress: 7.0-alpha-61215-src
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 143.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-One 2.7
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Steps to Reproduce

  1. Select any classic theme
  2. Appearance > Customize
  3. Click Change button next to the Active Theme
  4. Select WordPress.org themes
  5. Note the number of themes found at the top (as of the time my testing 8042)
  6. Click Filter themes
  7. Watch the number of themes found while clicking the filter checkboxes.
  8. Before applying patch, if you deselect a filter before the AJAX query properly completes, number of themes number may stay wrong.

Actual Results

  1. ✅ Issue resolved with patch.
  2. Deselecting a filter before the query completes does not cause issue and it always returns the correct number independent of when the checkbox is deselected.

Supplemental Artifacts

Video before:
https://files.catbox.moe/0u3fk8.mp4

Video after:
https://files.catbox.moe/re02nf.mp4

Note: See TracTickets for help on using tickets.