tableresponsive.js causes huge page load time for extensions page

Created on 30 April 2025, 9 days ago

Problem/Motivation

tableresponsive.js is used on the extensions page and elsewhere where tables are loaded. If a page has multiple tables (eg the extensions page with multiple module categories), the eventhandlerEvaluateColumnVisibility event handler will be invoked (number of tables) factorial times (for a page with 50 tables, 50 x 49 x 48... times).

Steps to reproduce

Open /admin/modules. Open the developer console of your web browser and find and set a breakpoint in the eventhandlerEvaluateColumnVisibility function. Reload the page and observe that the function is called repeatedly. If you also set a breakpoint at the TableResponsive.tables.push call in the behaviour function, you'll see that the event handler is called once after the first push, twice after the second and so on.

Proposed resolution

Add a flag to the top of the evaluate function, allowing the event handler to exit immediately before the last table is added. Set the flag during the attach call when we aren't on the last table being attached.

Remaining tasks

I have a working patch and have confirmed on my local that the page load time for my site that has 50 module categories goes from 30s plus to completing almost immediately. I have compared the page before and after applying the patch and have not found any differences.

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

Not required

πŸ› Bug report
Status

Active

Version

10.4 ✨

Component

javascript

Created by

πŸ‡¦πŸ‡ΊAustralia nigelcunningham Geelong

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024