-
Notifications
You must be signed in to change notification settings - Fork 92
gcgs-disable-async.php: Added new snippet to disable async.
#1191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughA new PHP snippet is added that filters Gravity Forms feed asynchronicity. For feeds with addon_slug 'gp-google-sheets', it forces synchronous processing by returning false from the Changes
Sequence DiagramsequenceDiagram
participant GF as Gravity Forms
participant Filter as gform_is_feed_asynchronous<br/>Filter
participant Callback as gcgs-disable-async<br/>Callback
participant Decision as Async Decision
GF->>Filter: Check if feed should be async<br/>(gform_is_feed_asynchronous)
Filter->>Callback: Execute registered callback<br/>(priority 50)
Callback->>Callback: Check feed['addon_slug']
alt addon_slug === 'gp-google-sheets'
Callback-->>Decision: Return false<br/>(force sync)
else Other addon
Callback-->>Decision: Return $is_async<br/>(preserve original)
end
Decision-->>GF: Async behavior determined
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
gc-google-sheets/gcgs-disable-async.php (1)
13-13: Consider adding defensive check for array key access.While Gravity Forms should always provide the
addon_slugkey, accessing it directly without validation could generate PHP notices if the feed array is malformed or missing this key.Apply this diff to add a defensive check:
- if ( $feed['addon_slug'] === 'gp-google-sheets' ) { + if ( ! empty( $feed['addon_slug'] ) && $feed['addon_slug'] === 'gp-google-sheets' ) { return false; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gc-google-sheets/gcgs-disable-async.php(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PHP Lint (PR)
gc-google-sheets/gcgs-disable-async.php
[warning] 13-13: PHPCS: Found precision alignment of 2 spaces.
[error] 13-13: PHPCS: Multi-line function call not indented correctly; expected 4 spaces but found 2.
🪛 GitHub Check: PHPCS (Files Changed)
gc-google-sheets/gcgs-disable-async.php
[failure] 17-17:
Line indented incorrectly; expected at least 1 tabs, found 2 spaces
[failure] 17-17:
Multi-line function call not indented correctly; expected 4 spaces but found 2
[warning] 17-17:
Found precision alignment of 2 spaces.
[failure] 15-15:
Line indented incorrectly; expected 1 tabs, found 2 spaces
[failure] 15-15:
Multi-line function call not indented correctly; expected 4 spaces but found 2
[warning] 15-15:
Found precision alignment of 2 spaces.
[failure] 14-14:
Line indented incorrectly; expected at least 2 tabs, found 1
[failure] 14-14:
Tabs must be used to indent lines; spaces are not allowed
[failure] 13-13:
Line indented incorrectly; expected 1 tabs, found 2 spaces
[failure] 13-13:
Multi-line function call not indented correctly; expected 4 spaces but found 2
[warning] 13-13:
Found precision alignment of 2 spaces.
🔇 Additional comments (1)
gc-google-sheets/gcgs-disable-async.php (1)
1-11: LGTM! Clear documentation and purpose.The header documentation clearly explains the snippet's purpose, use case, and installation instructions.
| add_filter( 'gform_is_feed_asynchronous', function( $is_async, $feed, $entry, $form ) { | ||
| if ( $feed['addon_slug'] === 'gp-google-sheets' ) { | ||
| return false; | ||
| } | ||
|
|
||
| return $is_async; | ||
| }, 50, 4 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation to use tabs instead of spaces.
The PHPCS pipeline is failing because the function body uses spaces for indentation instead of tabs, which violates the project's coding standards.
Apply this diff to fix the indentation:
add_filter( 'gform_is_feed_asynchronous', function( $is_async, $feed, $entry, $form ) {
- if ( $feed['addon_slug'] === 'gp-google-sheets' ) {
- return false;
- }
+ if ( $feed['addon_slug'] === 'gp-google-sheets' ) {
+ return false;
+ }
- return $is_async;
+ return $is_async;
}, 50, 4 );🧰 Tools
🪛 GitHub Actions: PHP Lint (PR)
[warning] 13-13: PHPCS: Found precision alignment of 2 spaces.
[error] 13-13: PHPCS: Multi-line function call not indented correctly; expected 4 spaces but found 2.
🪛 GitHub Check: PHPCS (Files Changed)
[failure] 17-17:
Line indented incorrectly; expected at least 1 tabs, found 2 spaces
[failure] 17-17:
Multi-line function call not indented correctly; expected 4 spaces but found 2
[warning] 17-17:
Found precision alignment of 2 spaces.
[failure] 15-15:
Line indented incorrectly; expected 1 tabs, found 2 spaces
[failure] 15-15:
Multi-line function call not indented correctly; expected 4 spaces but found 2
[warning] 15-15:
Found precision alignment of 2 spaces.
[failure] 14-14:
Line indented incorrectly; expected at least 2 tabs, found 1
[failure] 14-14:
Tabs must be used to indent lines; spaces are not allowed
[failure] 13-13:
Line indented incorrectly; expected 1 tabs, found 2 spaces
[failure] 13-13:
Multi-line function call not indented correctly; expected 4 spaces but found 2
[warning] 13-13:
Found precision alignment of 2 spaces.
🤖 Prompt for AI Agents
In gc-google-sheets/gcgs-disable-async.php around lines 12 to 18, the anonymous
function body uses spaces for indentation which breaks PHPCS; replace the
leading spaces with tabs for each indented line inside the add_filter call
(function body, the if block, return statements, and the closing brace) so
indentation uses tabs consistently and matches the surrounding file style, then
run PHPCS to verify the fix.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/3095424739/90097
📓 Notion: https://www.notion.so/gravitywiz/Doc-Update-GCGS-Feeds-Not-Running-2b600ab68edf802f86bbfa228520f90e
Summary
This snippet disables async on GCGS feeds. This is one of the first troubleshooting steps we recommend when debugging GCGS feed issues. Adding the snippet to the SL will help reference this in the docs and also support tickets.