Skip to content

fix(web): stabilize stack builder URL state - #1129

Merged
AmanVarshney01 merged 4 commits into
mainfrom
aman/fix-stack-builder-url-state
Jul 31, 2026
Merged

fix(web): stabilize stack builder URL state#1129
AmanVarshney01 merged 4 commits into
mainfrom
aman/fix-stack-builder-url-state

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • upgrade nuqs from 2.9.2 to 2.9.4 for the upstream concurrent-rebase fixes
  • apply stack updates through the supported useQueryStates functional updater so rapid selections merge against current URL state
  • memoize sanitized URL state and derive the CLI command without a state-setting effect
  • render the compatibility-adjusted stack immediately and remove the transient sidebar compatibility log
  • add regression coverage for selecting Nuxt and Expo while Nuxt changes tRPC to oRPC

Root cause

The stack builder wrapper evaluated functional updates against a render-captured stack instead of passing them through to useQueryStates. When a selection triggered a compatibility adjustment, concurrent URL updates could overwrite a following selection. The unstable sanitized state also retriggered the command synchronization effect until React reported Maximum update depth exceeded. The sidebar rendered the temporary invalid state and its compatibility log before the canonical URL state landed, causing the visible flicker.

Impact

Nuxt and Expo can be selected together again. Frontend and other compatibility-driven selections no longer flicker, lose subsequent clicks, or trigger a React update loop.

Verification

  • bun build:web
  • bun test apps/web/test/stack-builder-compatibility.test.ts apps/web/test/stack-compatibility-invariant.test.ts (26 passing)
  • targeted oxlint and git diff --check
  • browser-tested Nuxt -> Expo + Bare; URL and generated command retain both selections with no console errors

Summary by CodeRabbit

  • New Features

    • Stack selections now automatically reflect compatibility adjustments across badges and technology lists.
    • Generated frontend commands stay synchronized with the adjusted stack.
    • View mode and selected-file settings are preserved more reliably when updating stack configurations.
  • Bug Fixes

    • Improved compatibility handling when switching Nuxt APIs while preserving related selections.
    • Native frontend support and combined frontend command options now work correctly.
    • Compatibility-adjusted API selections can be reset cleanly.
  • Tests

    • Added coverage for Nuxt API compatibility behavior and selection removal.

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
create-better-t-stack-web Ready Ready Preview Jul 31, 2026 8:56pm

Request Review

@AmanVarshney01
AmanVarshney01 marked this pull request as ready for review July 31, 2026 20:48
@AmanVarshney01
AmanVarshney01 force-pushed the aman/fix-stack-builder-url-state branch from 3e08804 to a2c28d5 Compare July 31, 2026 20:49
@AmanVarshney01
AmanVarshney01 enabled auto-merge (squash) July 31, 2026 20:49
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The stack builder now applies compatibility-adjusted stacks to commands and technology displays. URL state sanitization and setters use memoized callbacks. Compatibility tests cover Nuxt, Expo, oRPC, retained selections, removal fallbacks, and combined frontend output. The web app updates its nuqs dependency range.

Changes

Stack builder behavior

Layer / File(s) Summary
Memoized URL state updates
apps/web/src/lib/stack-url-state.client.ts
Stack sanitization and query-state setters now use memoized callbacks and functional updates.
Compatibility-adjusted stack flow
apps/web/src/app/(home)/new/_components/stack-builder/use-stack-builder.ts, apps/web/src/app/(home)/new/_components/stack-builder/index.tsx
Compatibility helpers calculate adjusted selections and removal fallbacks. Commands, badges, and technology lists use the effective stack. The desktop compatibility log was removed.
Compatibility validation and dependency update
apps/web/test/stack-builder-compatibility.test.ts, apps/web/package.json
Tests cover Nuxt with Expo, oRPC compatibility, retained selections, removal fallbacks, and combined frontend flags. The nuqs range changed to ^2.9.4.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the web stack builder URL state stabilization, which is the primary change in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e0debbd-6092-4f65-8389-23bca475e739

📥 Commits

Reviewing files that changed from the base of the PR and between c86c086 and 3e08804.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • apps/web/package.json
  • apps/web/src/app/(home)/new/_components/stack-builder/index.tsx
  • apps/web/src/app/(home)/new/_components/stack-builder/use-stack-builder.ts
  • apps/web/src/lib/stack-url-state.client.ts
  • apps/web/test/stack-builder-compatibility.test.ts

Comment thread apps/web/src/app/(home)/new/_components/stack-builder/use-stack-builder.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e08804e8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/app/(home)/new/_components/stack-builder/index.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/web/src/app/(home)/new/_components/stack-builder/use-stack-builder.ts (1)

157-160: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Stabilize the compatibility analysis used by this memoized command.

analyzeStackCompatibility(stack) creates new adjustedStack and changes objects on every render. When compatibility changes exist, unrelated state updates rerun this memo and the compatibility effect. Memoize the analysis by stack.

Suggested change
-  const compatibilityAnalysis = analyzeStackCompatibility(stack);
+  const compatibilityAnalysis = useMemo(
+    () => analyzeStackCompatibility(stack),
+    [stack],
+  );

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 85e9c38a-2522-4a7f-a9ac-e983560ba868

📥 Commits

Reviewing files that changed from the base of the PR and between bafe07b and ae0a08e.

📒 Files selected for processing (2)
  • apps/web/src/app/(home)/new/_components/stack-builder/use-stack-builder.ts
  • apps/web/test/stack-builder-compatibility.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/test/stack-builder-compatibility.test.ts

@AmanVarshney01
AmanVarshney01 merged commit 489843e into main Jul 31, 2026
3 checks passed
@AmanVarshney01
AmanVarshney01 deleted the aman/fix-stack-builder-url-state branch July 31, 2026 21:10
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