Repository navigation
fix: Nuvemshop product images (CDN sizes) and default sort first - #633
Merged
Merged
Conversation
The deco image proxy answers 403 for dcdn-us.mitiendanube.com, so every Nuvemshop product image rendered broken. Like VTEX and Shopify, rewrite the URL to the platform CDN's native resize instead: Nuvemshop serves only fixed sizes picked by a filename suffix (-50/100/240/320/480/640-0, -1024-1024; anything else 403s), so pick the smallest one that covers the width. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A sort select with no ?sort_by= falls back to its first option, which showed 'Mais vendidos' while the list was actually newest-first (defaultSort). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Contributor
Author
|
Also included: |
|
🎉 This PR is included in version 7.77.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
vitoUwu
pushed a commit
to vitoUwu/deco-start
that referenced
this pull request
Nov 26, 2026
…ocms#493) ## Problem The vite plugin's `meta.gen.json` auto-regeneration runs `generate-schema.ts` **without `--compose`** at both invocation sites: - `plugin.js` — watch-driven regen (fires on any `src/**/*.ts(x)` add/change) - `plugin.js` — cold-start bootstrap (when the file is absent) `generate-schema.ts` defaults `COMPOSE = false`, and its own header notes that without `--compose` the output "omits Page, matchers, `__SECTION_REF__`, Resolvable that `composeMeta` otherwise [injects]". So every regen writes an **uncomposed** manifest missing every framework `website/*` block. `meta.gen.json` is committed, and Studio reads it **as-is** (no `composeMeta` at read time). In a sandbox session the plugin rewrites it uncomposed, and the daemon's shutdown "sync all local changes" commits it — clobbering the composed manifest on the branch. The admin editors then break silently. Most visibly, `website/matchers/date.ts` disappears, so the variant-rule editor ("Regra de variante") loses its start/end **date fields**. Reported on casaevideo-tanstack (["o campo com as datas sumiu de novo"](deco-sites/casaevideo-tanstack#633)); a `lebiscuit-tanstack` whose committed manifest was still composed was unaffected. This recurred repeatedly (casaevideo decocms#494, decocms#566, decocms#633) — each time a hotfix restored the composed file, but the plugin re-clobbered it on the next session. ## Fix Route both invocations through a new exported `generateSchemaArgs(siteName)` helper that pins `--compose`, so the flag can't drift off one site. This mirrors `npm run generate`'s schema step (`blocks-cli generate --compose`) and the production build, which already compose. No other flags are needed: `generate-schema` defaults `--sections src/sections`, `--loaders src/loaders`, `--apps src/apps`, out `.deco/meta.gen.json` — exactly what sites pass. `composeMeta` is dynamically imported from `@decocms/blocks`, which is installed in the sandbox. ## Test `generateSchemaArgs` unit test asserts `--compose` is always present and the site is targeted. The invocations themselves live in the `configureServer` closure (needs a live vite server to exercise), so the helper is the unit boundary both sites derive their args from — the flag can't silently drop off one again. `npm run typecheck` and `vitest` (12 passed) green; no new Biome diagnostics. ## Note This is the generation-side root fix. The daemon committing a generated `meta.gen.json` is by design (it's committed for cold-start, and a vibecode agent may legitimately change an interface and regenerate it) — the defect was purely that the sandbox regen produced a *degraded* manifest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Composes meta.gen.json during dev/sandbox schema regeneration to stop committing an uncomposed manifest that removes framework website/* blocks and breaks admin editors. Previously the Vite plugin ran `generate-schema.ts` without `--compose`; now both watch and cold-start invocations always include `--compose` via a shared helper. - Centralizes args in `generateSchemaArgs(site)` and routes both invocations through it, pinning `--compose`. - Matches `npm run generate` and production behavior (`@decocms/blocks-cli` with `--compose`). - Adds unit tests that assert `--compose` is present and the target site is set. - No migration required; committed meta.gen.json remains composed and features like the date matcher in the variant rule editor persist. <sup>Written for commit b33d2bb. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/decocms/blocks/pull/493?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Co-authored-by: Claude Opus 4.8 <[email protected]>
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
getOptimizedMediaUrlgets a native path for Nuvemshop product images, alongside the existing VTEX and Shopify ones.Why
The deco image proxy (
assets.decocms.com/image) answers 403 fordcdn-us.mitiendanube.com. As a result, every product image on a Nuvemshop storefront rendered as broken. I found this while running a TanStack site on@decocms/apps-nuvemshop.Nuvemshop's CDN only serves fixed sizes, chosen by a filename suffix:
-50-0,-100-0,-240-0,-320-0,-480-0and-640-0;-1024-1024, which is the 1000px original.Any other size answers 403; I checked each size against the live CDN. The optimizer now picks the smallest size that covers the requested width, falling back to
-1024-1024, and keeps the file extension. Non-product URLs on the same host keep going through the default path.Verified
3 new tests;
@decocms/blockshas 906 tests passing andtscis clean. The biome errors in these two files were already onmain(whole-file format drift plus an existinguseAltText). The added lines follow the file's existing style, and I did not reformat the files.🤖 Generated with Claude Code
Summary by cubic
Fixes two Nuvemshop storefront issues: product images returned 403 through the deco image proxy, and a sort select without
?sort_by=showed "Mais vendidos" instead of the real default order.-50-0…-640-0, else-1024-1024) and keeping the extension; non-product URLs still use the default path.defaultSortfirst so the UI matches the actual listing order.Written for commit c3472e2. Summary will update on new commits.