Repository navigation
fix: section ordering with index-based merge - #5
Merged
Merged
Conversation
…merge Eager sections now get their original CMS position stamped as `index` in resolveDecoPage. mergeSections uses index-based sorting instead of slot-filling, which broke when raw sections resolved to 0 items (e.g. multivariate flags with no match). Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
🎉 This PR is included in version 0.16.4 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/cms/resolve.ts">
<violation number="1" location="src/cms/resolve.ts:881">
P1: Avoid mutating cached resolved sections when stamping `index`; clone each section before adding per-page position data.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Comment on lines
+881
to
+882
| for (const s of sections) s.index = idx; | ||
| return sections; |
There was a problem hiding this comment.
P1: Avoid mutating cached resolved sections when stamping index; clone each section before adding per-page position data.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/cms/resolve.ts, line 881:
<comment>Avoid mutating cached resolved sections when stamping `index`; clone each section before adding per-page position data.</comment>
<file context>
@@ -876,9 +876,11 @@ export async function resolveDecoPage(
- // For flat index tracking, assume 1 per raw section (most common case)
+ const idx = currentFlatIndex;
+ eagerResults.push(promise.then((sections) => {
+ for (const s of sections) s.index = idx;
+ return sections;
+ }));
</file context>
Suggested change
| for (const s of sections) s.index = idx; | |
| return sections; | |
| return sections.map((s) => ({ ...s, index: idx })); |
vibe-dex
added a commit
that referenced
this pull request
May 1, 2026
…checklist (#109) Two stale areas in the deco-to-tanstack-migration skill, plus one brand-new reference distilling battle-tested cleanup patterns. ## Changes ### `templates/vite-config.md` — drop ~80 lines of stub duplication The old template inlined the entire `deco-server-only-stubs` plugin (react-dom/server, node:async_hooks, node:stream, node:stream/web, tanstack-head-scripts) — ~60 lines that exactly mirror what `@decocms/start/vite`'s `decoVitePlugin()` already does. The new template uses `decoVitePlugin()` and adds the production-grade boilerplate that real sites actually need (and that the old version omitted): VTEX dev proxy, CSP frame-ancestors header, build sourcemap, PLUGIN_WARNING filter, react-compiler config, `pure: ["console.log"]`, and the full `dedupe` list including `@decocms/start` + `@decocms/apps`. ### `references/vite-config/README.md` — fix "minimal" config that was broken The "post-migration minimal config" was missing `decoVitePlugin()` entirely. Without it, the client bundle crashes on transitively imported server modules. Added the plugin + the minimum dedupe list, and cross-referenced the full template. ### `references/post-migration-cleanup.md` — NEW Dedicated reference distilling the cleanup work that surfaces on every real migration: 1. Detect + delete unused `src/lib/*` shims (with a copy-paste detection script). Real-world data: baggagio-tanstack had 11 generated shims and 0 actual users; casaevideo had 11 generated and 1 used. 2. Drop the `site-manual-chunks` and `deco-stub-meta-gen` inline plugins that are now framework-provided in `@decocms/start >= 2.5.0`. 3. Drop the `runtime.ts` `invoke` shim — `@decocms/start/sdk` exports both `invoke` (singleton) and `createAppInvoke` (typed factory). 4. Drop site-local `withSiteGlobals` workaround — framework helper is now opt-in and tested. 5. Verify VTEX util imports point direct at `@decocms/apps/vtex/...`, not at dead `~/lib/vtex-*` shims (the migration script's stale `phase-cleanup.rewriteVtexUtilImports` was silently regressing them). 6. Search for orphan `TODO: move into framework` comments and either migrate, file an issue, or delete. Plus a verification checklist. ## Why now Validated in this session against three reference sites (casaevideo-storefront, baggagio-tanstack, casaevideo). Each cleanup step has a corresponding shipped or in-flight PR (#103/#106/#107/#108 on framework, #5/#6/#7 on baggagio-tanstack), so the checklist isn't speculative. ## Scope discipline This PR only edits skill content; no source/runtime changes. Both `.agents/skills/` and `.cursor/skills/` copies stay in sync. Made-with: Cursor
guitavano
added a commit
that referenced
this pull request
Nov 17, 2026
…anStack Start, esbuild) (#832) Closes the open Dependabot alerts in one PR, with the lockfile. The Dependabot PRs (#811, #828, #747) only touch `package.json`, so they all fail `bun install --frozen-lockfile` in CI. | Package | From | To | Alerts | |---|---|---|---| | `react-server-dom-webpack` (tanstack-rsc-smoke) | 19.2.7 | 19.2.9 | #19, critical: RSC RCE, GHSA-xqc2-xf4c-x3h3 | | `react` / `react-dom` (all pinned workspaces) | 19.2.7 | 19.2.9 | peer floor of the above | | `next` (nextjs, compat-v7, nextjs-binding-smoke) | 16.3.8 | 16.4.6 | #10–12, #14, #15, #17, #18, #20–22 | | `@tanstack/react-start` (tanstack, compat-v7, smokes) | 1.168.58 | 1.168.61 | #2–4, #7, #9 | | `@tanstack/react-router` | 1.170.39 | 1.170.42 | the version react-start 1.168.61 pins, so it stays a single copy | | `esbuild` (blocks, tanstack, compat-v7) | ^0.27.3 | ^0.28.2 | #5, #6, #8 (low) | `bun.lock` was regenerated with bun 1.3.5 (the `packageManager`). React dedupes to a single 19.2.9 at the root, with no nested copies. Vite still has its own transitive `[email protected]` (its own range); that is outside our manifests. Supersedes #811, #828 and #747. ### Verified locally (bun 1.3.5, node 24) - `bun install --frozen-lockfile` ✅ - `bun run typecheck` ✅ · `bun run lint` ✅ - `bun x vitest run`: 3388 passed, 0 failed ✅ (includes `tests/release.test.ts`) - `examples/tanstack-worker-smoke`: build + smoke ✅ - `examples/nextjs-binding-smoke`: build + smoke ✅ - `examples/tanstack-rsc-smoke`: build + typecheck ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Bumps several dependencies to clear open Dependabot security alerts, including a critical RCE in `react-server-dom-webpack` (GHSA-xqc2-xf4c-x3h3). The lockfile was regenerated so `bun install --frozen-lockfile` passes — React dedupes to a single 19.2.9 copy. **Dependencies** - `react`, `react-dom`, and `react-server-dom-webpack` 19.2.7 → 19.2.9 - `next` 16.3.8 → 16.4.6 - `@tanstack/react-start` 1.168.58 → 1.168.61, with `@tanstack/react-router` 1.170.42 - `esbuild` ^0.27.3 → ^0.28.2; Vite's own transitive `[email protected]` is untouched - Typecheck, lint, the full test suite (3388 passed), and the Next.js and TanStack smoke builds all pass <sup>Written for commit 123acc8. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/decocms/blocks/pull/832?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="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/decocms/blocks/832?returnTo=https%3A%2F%2Fgithub.com%2Fdecocms%2Fblocks%2Fpull%2F832&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Co-authored-by: Claude Opus 5.5 <[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.
Summary
index(original CMS position) on eager sections inresolveDecoPagemergeSections()from slot-filling to index-based sortingThe old slot-filling approach assumed
totalSlots = resolved.length + deferred.lengthequals the raw section count. When a raw section resolves to nothing (e.g. multivariate flag with no match), the total is wrong and eager sections (like Footer) get placed in wrong positions.Test plan
🤖 Generated with Claude Code
Summary by cubic
Fix section ordering by switching to index-based merging of eager and deferred sections. Keeps CMS order intact even when some raw sections resolve to nothing (e.g., multivariate flags).
indexon eager sections inresolveDecoPage.mergeSections()to merge eager and deferred sections in the correct order.Written for commit f91c592. Summary will update on new commits.