- 🔹 1. A Custom Command Is Printing Too Many Lines
- 🔹 2. Infinite Loops or Heavy Synchronous JavaScript
- 🔹 3. Add-On Script Loaded Twice
- 🔹 4. Theme or Page Builder Animations Causing Lag
- 🔹 5. Script Optimization Plugins Interfering
- 🔹 6. Extremely Large JSON Objects Printed to the Terminal
- 🔹 7. Third-Party JavaScript Errors Flooding Console
- 🔹 8. REST API Calls Taking Too Long
- 🔹 9. CSS Issues Causing Reflows/Repaints
- 🔹 10. Too Many Nested Event Listeners
- 🔹 11. Browser Extensions Causing Slowdowns
- 🎯 Summary
Fix slow typing, delayed output, UI freezing, or heavy resource usage inside the terminal.
If the terminal becomes slow, unresponsive, or freezes completely, this is almost always caused by custom commands, add-on scripts, or theme/optimizer conflicts that overload the browser.
This guide helps pinpoint the source and restore smooth performance.
🔹 1. A Custom Command Is Printing Too Many Lines #
Most common cause of terminal freezing:
for (let i = 0; i < 5000; i++) {
append_line("spam");
}
The browser cannot handle thousands of DOM nodes instantly.
Fix:
- Reduce output
- Batch or throttle output
- Print summaries instead of raw data
Example improved version:
for (let i = 0; i < 100; i++) {
append_line("line " + i);
}
100 lines = safe
5,000 lines = instant freeze
🔹 2. Infinite Loops or Heavy Synchronous JavaScript #
If your command contains:
while(true) {}
or:
for (let i = 0; i < 1e9; i++) {}
The browser’s main thread locks → entire terminal (and page) freezes.
Fix:
Use async spacing:
async function work() {
for (let i = 0; i < bigNumber; i++) {
if (i % 500 === 0) await new Promise(r => setTimeout(r));
}
}
Or simpler:
Break work into chunks.
🔹 3. Add-On Script Loaded Twice #
Duplicate scripts cause:
- commands running twice
- event handlers duplicating
- output printing multiple times
- lag on typing
- cursor desync
Check DevTools → Network → JS
If you see:
my-addon.js (x2)
cointacted-social-terminal-terminal.js (x2)
Fix:
- remove duplicate shortcode
- remove builder injecting duplicate scripts
- remove custom enqueues causing double loads
Only one terminal can exist per page.
🔹 4. Theme or Page Builder Animations Causing Lag #
Heavy animations applied by Elementor, Divi, Bricks, or Oxygen can cause lag inside the terminal.
Common offenders:
- scroll effects
- motion effects
- entrance animations
- parallax
- CSS transform on container
Fix:
Disable animations in the container holding the terminal.
Recommended CSS:
.cointacted-social-terminal,
.cointacted-social-terminal * {
animation: none !important;
transition: none !important;
transform: none !important;
}
🔹 5. Script Optimization Plugins Interfering #
Plugins like:
- WP Rocket
- LiteSpeed Cache
- Autoptimize
- SG Optimizer
- NitroPack
…may:
- defer terminal scripts
- combine JS files incorrectly
- break event order
- delay important functions
Fix:
- Exclude terminal JS from defer/minify
- Disable “Defer All JavaScript”
- Disable “Combine JavaScript”
- Clear cache and purge CDN
🔹 6. Extremely Large JSON Objects Printed to the Terminal #
If a command prints massive data from REST:
append_line(JSON.stringify(hugeObject))
…your browser will choke.
Fix:
Print summaries:
append_line("Items: " + data.items.length);
append_line("Status: " + data.status);
Never dump entire objects unless debugging.
🔹 7. Third-Party JavaScript Errors Flooding Console #
If another plugin spams the console with errors:
Error: cannot read property X
Error: undefined is not a function
…the browser slows down significantly.
Fix:
- Disable conflicting plugins
- Look for scripts broken by minifiers
- Switch theme temporarily to confirm conflict
🔹 8. REST API Calls Taking Too Long #
Slow REST → slow terminal.
If your commands make calls like:
await fetch('/wp-json/.../heavy-endpoint');
And the endpoint:
- queries a huge DB table
- loops too much
- pulls heavy external API
- has no caching
Then the terminal waits (appears frozen).
Fix:
- add caching to REST callback
- optimize database queries
- reduce external API calls
- return lightweight JSON
🔹 9. CSS Issues Causing Reflows/Repaints #
High-cost CSS includes:
- box-shadow animations
- blur filter
- large backdrop-filter
- large border-radius inside animations
- CSS transitions on every keystroke
Fix:
.cointacted-social-terminal * {
animation: none !important;
transition: none !important;
}
🔹 10. Too Many Nested Event Listeners #
If your add-on attaches listeners every time the terminal loads:
document.addEventListener('cointacted_social_terminal_output', ...)
…and does not remove or prevent duplicates, the terminal slows down.
Fix:
if (!window.MyAddonListenerAdded) {
window.MyAddonListenerAdded = true;
document.addEventListener('cointacted_social_terminal_output', (e) => {
console.log("Output event", e.detail);
});
}
Use a guard variable.
🔹 11. Browser Extensions Causing Slowdowns #
Known slowdown culprits:
- Grammarly
- LanguageTool
- Password managers
- React development tools
- Web3 blockers
- Accessibility extensions
- Over-aggressive adblockers
Test in:
- Chrome Incognito
- Firefox Private Mode
If problem disappears → extension is the cause.
🎯 Summary #
If the terminal freezes or lags:
✔ Avoid heavy loops or printing thousands of lines #
✔ Remove duplicate terminal instances #
✔ Disable animations in theme or builder #
✔ Exclude terminal JS from minify/defer #
✔ Stop printing huge JSON #
✔ Prevent multiple event listeners #
✔ Test without browser extensions #
✔ Optimize REST callbacks #
With 1–2 corrections, performance almost always returns to perfect.