Fix dynamic column limiting in entries list not working when there ar…#2481
Conversation
WalkthroughUpdated maybeInitEntriesListPage to check for the body class frm-admin-page-entries instead of formidable_page_formidable-entries before initializing the entries list page. No other logic or public/exported signatures were changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant W as Window
participant D as Document (body)
participant E as EntriesList Init
U->>W: Load admin page
W->>D: DOMContentLoaded
rect rgba(230,245,255,0.6)
note over D: maybeInitEntriesListPage
alt NEW condition
D-->>E: body.classList.contains("frm-admin-page-entries") = true
E-->>E: initialize entries list page
else condition not met
D-->>E: Skip initialization
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
js/src/admin/admin.js (2)
10005-10007: Add a backward-compatible fallback for older/edge contextsSome installs may still rely on the older WP-admin body class. A gentle OR fallback keeps this robust without reintroducing the bug.
- if ( ! document.body.classList.contains( 'frm-admin-page-entries' ) ) { + const body = document.body; + if ( ! ( body.classList.contains( 'frm-admin-page-entries' ) + || body.classList.contains( 'formidable_page_formidable-entries' ) ) ) { return; }
10014-10022: Avoid initial flicker and add null-safety around legend
- The warning note briefly flashes before
disableCheckboxesIfAtMax()hides it.legendmay be null on atypical Screen Options markup.- const maxSelectionsNote = div( { - className: 'frm_warning_style', + const maxSelectionsNote = div( { + className: 'frm_warning_style frm_hidden', text: __( 'Only 10 columns can be selected at a time.', 'formidable' ), } ); maxSelectionsNote.style.margin = 0; - const legend = screenOptionsWrapper.querySelector( 'legend' ); - legend.parentNode.insertBefore( maxSelectionsNote, legend.nextElementSibling ); + const legend = screenOptionsWrapper.querySelector( 'legend' ); + if ( ! legend || ! legend.parentNode ) { + return; + } + legend.parentNode.insertBefore( maxSelectionsNote, legend.nextElementSibling );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
js/src/admin/admin.js(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Run PHP Syntax inspection (8.3)
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
🔇 Additional comments (1)
js/src/admin/admin.js (1)
10005-10007: Fix detection of Entries List page — LGTMSwitching the guard to the body class
frm-admin-page-entriescorrectly scopes initialization and addresses the column-limit logic not running when inbox notices alter the page context.
…e inbox notieces