Autocomplete does not init for files dropdown for new action#2395
Conversation
WalkthroughThe changes update the initialization of selection autocomplete functionality within Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AdminJS
participant frmDomAutocomplete
User->>AdminJS: Triggers action (e.g., load, duplicate, add)
AdminJS->>AdminJS: Calls initAutocomplete(container)
AdminJS->>frmDomAutocomplete: Calls initSelectionAutocomplete(container)
frmDomAutocomplete-->>AdminJS: Initializes autocomplete in container
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
✨ Finishing Touches
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
js/formidable_admin.js (3)
7133-7136: Normalise the argument type
newActionis a raw DOM element, whereas other call-sites pass a jQuery object. Keep the contract consistent and shield the downstream API from mixed types.- initSelectionAutocomplete( newAction ); + initSelectionAutocomplete( jQuery( newAction ) );
7232-7234: Same normalisation applies hereFor consistency and safety, wrap
newActionin jQuery before forwarding.- initSelectionAutocomplete( newAction ); + initSelectionAutocomplete( jQuery( newAction ) );
9206-9208: Make the wrapper tolerant to input variationsAccept either a DOM node, jQuery object, or no argument at all to remain backward-compatible and avoid type issues.
-function initSelectionAutocomplete( container ) { - frmDom.autocomplete.initSelectionAutocomplete( container ); +function initSelectionAutocomplete( container ) { + const $container = container ? jQuery( container ) : undefined; + frmDom.autocomplete.initSelectionAutocomplete( $container ); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
js/formidable_admin.js(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (19)
- GitHub Check: Run PHP Syntax inspection (8.3)
- GitHub Check: Run PHPCS inspection
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: Run Rector inspection
- GitHub Check: Run PHP Syntax inspection (8.3)
- GitHub Check: Run PHPCS inspection
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Run ESLint
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Run Rector inspection
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Run PHPCS inspection
- GitHub Check: Psalm
- GitHub Check: Cypress
- GitHub Check: Cypress
- GitHub Check: Run PHP Syntax inspection (8.3)
🔇 Additional comments (1)
js/formidable_admin.js (1)
654-654: Let’s correct the regex and search again for zero-arg calls:#!/bin/bash # Find invocations of initSelectionAutocomplete() with no arguments rg -n 'initSelectionAutocomplete\s*\(\s*\)' --glob '*.js'
truongwp
left a comment
There was a problem hiding this comment.
This looks good. Thanks @Crabcyborg!
|
Thanks @truongwp! 🚀 |
I was working on a Google Sheets release, but noticed that the autocomplete dropdown was always empty for a new form action.
This update fixes it, and makes some of the calls more consistent.
I added a temporary workaround in the Google Sheets code as well so I could still get a release out https://github.com/Strategy11/formidable-googlespreadsheet/pull/66