Fix: Ensure Query Loop pagination inherits adjusted query vars & cache variation args#608
Fix: Ensure Query Loop pagination inherits adjusted query vars & cache variation args#608
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Warning CodeRabbit GitHub Action detectedThe repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action. Warning Rate limit exceeded@krugazul has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 26 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (15)
WalkthroughRefactors WETU map URL generation into a helper and updates map rendering to use it. Adds per-block query-args caching, block-driven modal registration via modal-button, a YouTube MutationObserver and slider tweaks, read-more guards, UI toggles, pattern/content updates, CSS spacing tweaks, asset version bumps, and documentation link updates. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as Viewer
participant WP as WP Render
participant Bind as Bindings
participant Helper as get_wetu_map_link
participant WETU as WETU Service
User->>WP: Request page with Map block
WP->>Bind: render_map_block($block,...)
Bind->>Helper: get_wetu_map_link(context, post_meta)
alt Tour / Accommodation / Cluster
Helper->>WETU: Build Itinerary/EmbedMap URL with IDs
WETU-->>Helper: URL string
else Coordinates only
Helper-->>Bind: Coordinate-centred EmbedMap URL
end
Bind-->>WP: Iframe markup (with class preserved for Google maps)
WP-->>User: Rendered iframe
sequenceDiagram
autonumber
participant WP as Block Renderer
participant Modals as Modals
participant Store as modal_contents
WP->>Modals: render modal-button block
Modals->>Modals: register_button_modal(block_content, block)
alt modalId present and not registered
Modals->>Modals: register_modal_content(slug)
Modals->>Store: save modal HTML by slug
end
Modals-->>WP: return block_content
sequenceDiagram
autonumber
participant DOM as Document
participant JS as lsx_to
participant Obs as MutationObserver
participant Slider as build_video_slider
DOM->>JS: document.ready -> lsx_to.watch_for_youtube_videos()
JS->>Obs: observe .lsx-block-videos subtree
DOM-->>Obs: YouTube iframe inserted
Obs-->>JS: change detected (debounced 200ms)
JS->>Slider: rebuild video slider
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Pull Request Overview
This pull request makes several enhancements to the Tour Operator plugin, focusing on Query Loop pagination, JavaScript slider improvements, template pattern updates, and various bug fixes.
Key changes include:
- Fixed Query Loop pagination not inheriting correct query variables by implementing caching of processed query args
- Enhanced JavaScript slider functionality with improved dots display and read-more button validation
- Updated travel information pattern with improved structure and modal functionality
- Added filter for controlling facility block links and improved modal handling
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/js/custom.js | Added validation checks for read-more functionality and enabled dots display for sliders |
| src/css/_modals.scss | Added styling for template part margin handling in modals |
| includes/template-tags/general.php | Added filter to control facility links and improved HTML structure |
| includes/patterns/travel-information.php | Complete redesign of travel information pattern with improved layout and modal integration |
| includes/metaboxes/config-post.php | Updated media metabox configuration and gallery description |
| includes/classes/frontend/class-modals.php | Enhanced modal system with better button registration and content handling |
| includes/classes/blocks/class-query-loop.php | Fixed pagination inheritance by implementing query caching mechanism |
| includes/classes/blocks/class-bindings.php | Enhanced map block rendering with improved WETU integration |
| changelog.md | Added entries for new features and bug fixes |
| build/* | Updated compiled assets with new version hashes |
Comments suppressed due to low confidence (1)
includes/patterns/travel-information.php:1
- This line appears to contain corrupted HTML content with malformed block comments and mixed content that would break the pattern structure.
<?php
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Warwick Booth <krugazul@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Warwick Booth <krugazul@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Warwick Booth <krugazul@users.noreply.github.com>
There was a problem hiding this comment.
Files selected (10)
- .github/copilot-wpcs.md (8)
- changelog.md (3)
- includes/classes/blocks/class-bindings.php (2)
- includes/classes/blocks/class-query-loop.php (4)
- includes/classes/frontend/class-modals.php (5)
- includes/metaboxes/config-post.php (2)
- includes/patterns/travel-information.php (1)
- includes/template-tags/general.php (2)
- src/css/_modals.scss (1)
- src/js/custom.js (5)
Files not summarized due to errors (10)
- includes/metaboxes/config-post.php (nothing obtained from openai)
- includes/patterns/travel-information.php (diff tokens exceeds limit)
- .github/copilot-wpcs.md (nothing obtained from openai)
- includes/classes/frontend/class-modals.php (nothing obtained from openai)
- includes/classes/blocks/class-query-loop.php (nothing obtained from openai)
- changelog.md (nothing obtained from openai)
- includes/classes/blocks/class-bindings.php (nothing obtained from openai)
- includes/template-tags/general.php (nothing obtained from openai)
- src/js/custom.js (nothing obtained from openai)
- src/css/_modals.scss (nothing obtained from openai)
Files not reviewed due to errors (9)
- changelog.md (no response)
- .github/copilot-wpcs.md (no response)
- includes/classes/blocks/class-query-loop.php (no response)
- includes/classes/frontend/class-modals.php (no response)
- includes/metaboxes/config-post.php (no response)
- includes/classes/blocks/class-bindings.php (no response)
- src/js/custom.js (no response)
- src/css/_modals.scss (no response)
- includes/template-tags/general.php (no response)
Files skipped from review due to trivial changes (1)
- includes/patterns/travel-information.php (diff too large)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.
Summary
Fixes an issue where Query Loop / pagination pages were not inheriting the adjusted query vars applied by Tour Operator block variations (e.g. featured / related / on-sale / parents-only). Introduces cached processing of query args per core/query block instance so subsequent renders (including pagination, multiple template passes, and nested block re-renders) reuse the same altered args.
Problem
Pagination for Query Loop blocks (and any re-render cycle on the same request) would re-run
query_args_filterand, in some cases, lose previously injected modifications (meta_query additions, post__in filtering, parent filters, featured pre-query overrides). This resulted in:Key Changes
$saved_queriesproperty toQuery_Loopclass to cache processed query args keyed by the core/queryqueryId.query_args_filterearly when a cached set of args exists, ensuring stable inheritance across pagination and repeated renders.lsx_to_featuredshadow query linkage persist across requests within the same render cycle.Affected File(s)
includes/classes/blocks/class-query-loop.phpchangelog.md(Added entry: “Query Block Pagination not Inherting the correct query vars.”)Detailed Behavior Improvements
Backwards Compatibility
lsx_to_*) unchanged.Testing Steps
on-saleor a featured/related variation) with pagination enabled.Performance Considerations
Caching removes redundant WP_Query executions for featured detection and related content resolution during a single request, reducing DB load on complex templates with repeated rendering.
Security
No new input surfaces. Uses existing sanitized values. Caching is per-request only (no persistence between requests).
Documentation / Changelog
Changelog updated under 2.1.0 “Fixed” section.
Follow Ups (Optional)
$parents_onlysimilar to$onsaleafter application for explicitness.Closes: (add issue reference if one exists)
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Documentation