-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add toggle optimization #38
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: develop
Are you sure you want to change the base?
Changes from 1 commit
25a4e64
6531588
6bf0a76
c3a1739
4252f9e
4995021
2486720
2106085
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,10 @@ function addDropZoneListenerToMediaManager( targetDocument ) { | |
| } | ||
|
|
||
| const customDropHandler = async event => { | ||
| if ( window.cimoSettings?.disableOptimization ) { | ||
| return | ||
| } | ||
|
Comment on lines
+42
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "1) Find every read/write of disableOptimization:"
rg -n -C2 --type=js --type=php '\bdisableOptimization\b'
echo
echo "2) Inspect cimoSettings localization payload(s):"
rg -n -C6 --type=php "wp_localize_script\\(|['\"]cimoSettings['\"]"
echo
echo "Expected:"
echo "- At least one initialization/assignment path for window.cimoSettings.disableOptimization"
echo " that runs before drop/select listeners are attached."Repository: gambitph/Cimo Length of output: 2782 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Searching for dynamic assignments to cimoSettings or disableOptimization ==="
rg -n 'cimoSettings\s*=|cimoSettings\[|window\.cimoSettings' --type=js --type=php
echo ""
echo "=== Checking admin settings page for disable optimization toggle ==="
rg -n -i 'disable.*optim|optim.*disable|toggle.*disable' --type=js --type=php
echo ""
echo "=== Searching for any REST endpoint that might set this state ==="
rg -n -i 'disableOptimization|disable_optimization' --type=phpRepository: gambitph/Cimo Length of output: 3007 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Search for floating toggle implementation ==="
rg -n -i 'floating.*toggle|toggle.*optim|showOptimizationToggle' --type=js -A5 -B5
echo ""
echo "=== Search for files in admin/js that might contain toggle logic ==="
fd -e js --path 'admin/js' | head -20
echo ""
echo "=== Check if there's a separate toggle component or widget ==="
rg -n 'class.*Toggle|function.*[Tt]oggle|const.*Toggle' --type=js --path 'admin' | head -30Repository: gambitph/Cimo Length of output: 8480 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Search for toggle widget or component ==="
fd -e js -e jsx --path 'admin' | xargs rg -l -i 'toggle.*widget|toggle.*component|floating.*toggle' | head -10
echo ""
echo "=== List all files in admin/js to understand structure ==="
find src/admin/js -type f -name '*.js' -o -name '*.jsx' | sort
echo ""
echo "=== Search for any localStorage or sessionStorage writes related to optimize ==="
rg -n 'localStorage|sessionStorage' --type=js --path 'admin' -B2 -A2
echo ""
echo "=== Check for window mutation patterns on cimoSettings ==="
rg -n 'window\.' --type=js --path 'admin/js' | grep -i 'optim\|disable' | head -20Repository: gambitph/Cimo Length of output: 389 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== List all files in admin/js ==="
find src/admin/js -type f \( -name '*.js' -o -name '*.jsx' \) | sort
echo ""
echo "=== Search for localStorage or sessionStorage ==="
rg -n 'localStorage|sessionStorage' --type=js | grep -v node_modules
echo ""
echo "=== Search for any toggle or optimization-related JS files ==="
find src -type f \( -name '*toggle*' -o -name '*optimize*' \) | grep -E '\.(js|jsx)$'
echo ""
echo "=== Check if toggle state is managed inline in drop-zone or select-files ==="
cat src/admin/js/media-manager/drop-zone.jsRepository: gambitph/Cimo Length of output: 501 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Read full drop-zone.js to understand context ==="
wc -l src/admin/js/media-manager/drop-zone.js
echo ""
echo "=== Read the file ==="
cat -n src/admin/js/media-manager/drop-zone.js
echo ""
echo "=== Read full select-files.js ==="
cat -n src/admin/js/media-manager/select-files.jsRepository: gambitph/Cimo Length of output: 17353
The guards at Lines 42 (drop-zone.js) and 34–37 (select-files.js) check Suggested fix--- a/src/admin/class-script-loader.php
+++ b/src/admin/class-script-loader.php
@@ -84,6 +84,7 @@ public function enqueue_scripts() {
'restUrl' => rest_url( 'cimo/v1/' ),
'nonce' => wp_create_nonce( 'wp_rest' ),
'isFrontend' => ! is_admin(),
+ 'disableOptimization' => 0,🤖 Prompt for AI Agents |
||
|
|
||
| // If this is a synthetic change event dispatched by us after conversion, skip conversion. | ||
| if ( event.__cimo_converted ) { | ||
| return | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.