Repository navigation
feat(sandbox): resilient path-param picker with homepage-link discovery - #5089
Merged
Merged
Conversation
Make the preview URL path-param picker work app-agnostically: classify category params, and when the configured loaders (VTEX category tree, Algolia/Magento product search) come up empty or absent, fall back to scraping the site's own homepage (and drilling one listing page) for real category and product URLs via the preview-fetch proxy — grouped side by side as Categorias | Produtos with product thumbnails. Also seeds empty product searches with generic color terms, strips surrounding slashes on free-text entry, and only auto-fills from primary sources. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rill target - Only query the homepage-links fallback once primaries are exhausted, so opening the picker on a healthy loader-backed page no longer fires the homepage + drill fetches (splits primary/fallback useQueries). - Drill into the first CATEGORY (a listing page) instead of home[0], which is a product when the homepage embeds shelves — a PDP has no shelf to scrape. - Trim GENERIC_SEED_TERMS 8→4 to halve the empty-term product-search fan-out. - Correct buildPreviewFetchPath JSDoc (any same-origin path, not a 2-path allowlist); un-export module-private siteLinksSource; drop duplicate "checkout" in NON_CATEGORY_SEGMENTS. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
PR: #5089 feat(sandbox): resilient path-param picker with homepage-link discovery Bump type: minor - decocms (apps/mesh/package.json): 4.102.0 -> 4.103.0 Deploy-Scope: both
rafavalls
added a commit
that referenced
this pull request
Jul 23, 2026
Only conflict was apps/mesh/src/web/components/sandbox/preview/preview.tsx, where main's new preview "display model" (#5084 production fallback while the dev server wakes, #5089 resilient path-param picker, #5086 confirm-before- auto-start) collided with this branch's header-portal redesign of the same toolbar. Resolution: keep the redesign's structure (urlControls / moreMenu extracted and portaled into the panel header via headerSlot) and adopt main's display model: - showPreviewToolbar now follows main's visibility — shown once an iframe surface is active (sandbox when the daemon is up, or the production fallback while it wakes) instead of `daemonReady && previewState.kind === "iframe"`. - canVisualEdit uses `display.mode === "sandbox"`. - "Open in new tab" resolves the URL via `iframeSrc ?? display.iframeBase` (previewState.previewUrl no longer exists under the display model). Main's toolbar-internal changes were pure re-indentation (verified against the base diff), so the extracted urlControls/moreMenu already carry them; main's other features (waking pill, confirm dialog) live outside the toolbar and auto-merged. Verified: tsc across all workspaces, oxlint (0), knip (clean), format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
The sandbox preview URL path-param picker only worked for VTEX PDPs; on other stores it showed an empty/dead modal or degraded to a bare text input. This makes it app-agnostic: params are classified (product/category), and when the site's configured loaders (VTEX category tree, Algolia/Magento product search) come up empty or absent, it falls back to scraping the site's own homepage — and drilling one listing page — for real category and product URLs via the existing
preview-fetchproxy (allowlist widened to same-origin GETs). Results render side by side as Categorias | Produtos with product thumbnails; empty product searches are seeded with generic color terms, free-text entry strips surrounding slashes, and auto-fill only commits from primary sources (never a fallback), fixing a bug where a Category param auto-filled a PDP.Screenshots/Demonstration
Granado (Magento, no working search loader) now lists real categories on the left and products with thumbnails on the right; clicking navigates to a valid PLP/PDP. Verified live in the studio dev sandbox.
How to Test
bun run dev, open the studio and a sandbox whose page uses a dynamic route (e.g. Granado/{granado/}?*, or a VTEX store's category*/ PDP:slug/p).bun test apps/mesh/src/web/components/sandbox/preview/path-param-picker.test.ts(56 pass).Migration Notes
None.
Review Checklist
Summary by cubic
Makes the sandbox preview URL path-param picker app-agnostic and resilient. It now prefers loader results and only falls back to homepage-link discovery, drilling a category listing to find real categories and products.
New Features
Bug Fixes
preview-fetchallowlist to same-origin paths only (rejects missing/invalid paths,//,..,\); tests cover fallback gating, homepage parsing, embedded products, and input normalization.Written for commit 68ca75a. Summary will update on new commits.