Skip to content

Remove verified dead code from frontend loader - #21

Merged
vapvarun merged 1 commit into
masterfrom
fix/ponytail-cleanup
Sep 12, 2026
Merged

vapvarun merged 1 commit into
masterfrom
fix/ponytail-cleanup

Conversation

@vapvarun

Copy link
Copy Markdown
Member

Cleanup only, no behavior change. Every cut is gated on a config key that is never localized via wp_localize_script (verified by grep before deleting), so the affected branches could never execute.

JS - public/js/infinite_loader_products.js

  • Removed the dead lazyLoadXT lazy-load subsystem: should_lazy_load(), prepare_lazy_load_content(), infinite_loader_update_lazyload(), both lazyLoadXT blocks, and the infinite_loader_update_lazyload var-decl entry. Gated on lazy_load / lazy_load_m / mobile_width / LLanimation - none are ever localized.
  • Collapsed the current_style() mobile branch (use_mobile / mobile_type never localized -> always fell through) to the single set_style(type) line.
  • Unwrapped the is_AAPF guard on the pagination click handler (is_AAPF never localized, so the guard was always true).
  • Left trigger_lazy_load() intact - it is a separate generic function, not part of the dead subsystem and not gated on dead keys.

PHP - public/class-infinite-loader-for-woocommerce-public.php

  • Dropped the is_mobile => wp_is_mobile() localize key - never read in JS.
  • Collapsed the two byte-identical hover-CSS methods into one private output_hover_css($opt, $sel, $filter, $id) helper; both wp_head callbacks remain and delegate to it (hook wiring unchanged).
  • Inlined the one-caller is_woocommerce_blocks_active() class_exists wrapper at its single call site.

Not touched (per scope)

  • mobile_type PHP option schema + the second "previous button" partial (a real independently-styled-second-button feature).
  • i18n class / load_plugin_textdomain, the icon-list data array, edd-license/.
  • dist/ zips.

Verification

  • php -l clean on both changed PHP files.
  • Rebuilt public/js/min/infinite_loader_products.min.js via grunt uglify:public (36.5 kB -> 16.6 kB); rebuilt min confirmed free of all removed symbols.
  • bash bin/build-release.sh exits 0: version agrees, PHP lint clean, contract audit clean, verify-build-freshness OK.

Cleanup only, no behavior change. All cuts gated on config keys that are
never localized via wp_localize_script (verified with grep):

- Drop the dead lazyLoadXT lazy-load subsystem in
  infinite_loader_products.js: should_lazy_load(),
  prepare_lazy_load_content(), infinite_loader_update_lazyload(), both
  lazyLoadXT blocks, and the var-decl entry. Gated on lazy_load,
  lazy_load_m, mobile_width, LLanimation - none ever localized.
- Collapse current_style() mobile branch (use_mobile/mobile_type never
  localized) to the single set_style(type) line.
- Unwrap the is_AAPF guard on the pagination click handler (key never
  localized, so the guard was always true).
- Drop the is_mobile localize key - never read in JS.
- Collapse the two byte-identical hover-CSS methods into one private
  output_hover_css() helper called by both wp_head callbacks.
- Inline the one-caller is_woocommerce_blocks_active() class_exists wrapper.

Rebuilt public/js/min/infinite_loader_products.min.js to match source.
@vapvarun
vapvarun merged commit 6f7b6d9 into master Sep 12, 2026
7 checks passed
@vapvarun
vapvarun deleted the fix/ponytail-cleanup branch September 12, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant