Skip to content

[Refactor/Chore] Align nuqs peer resolution to avoid duplicate browser runtime modules #42438

Closed

Description

@hyoban

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is a refactor/chore rather than a support question.
  • I have searched existing issues, including closed ones.
  • I confirm that I am using English to submit this report.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • I have filled in the required template fields.

Description

Align workspace peer dependency resolution so the browser build includes one nuqs 2.10.1 instance. In a local Dify build, packages/nuqs-jotai/node_modules/nuqs resolves to the Next 16.3.4 peer context, while web/node_modules/nuqs resolves to Next 16.3.5. Both copies appear in Rolldown's client package graph, contributing 25,545 and 39,411 bytes respectively.

Reproduction:

  1. Install dependencies from the affected lockfile and build the Vinext browser target.
  2. Compare the two nuqs symlink targets / lockfile importer entries.
  3. Inspect the client package graph and find two nuqs 2.10.1 package roots with distinct Next peer contexts.

Motivation

This duplicates runtime code. This is not a confirmed URL-state bug: this nuqs release shares adapter context, throttle queue, debounce controller and sync emitter through global singletons keyed by version (and React identity for the context).

Acceptance criteria:

  • Align workspace peer resolution and regenerate the lockfile using the project's package manager.
  • Verify only one nuqs instance contributes browser runtime modules.
  • Preserve adapter behavior and nuqs-jotai URL update/queue semantics.
  • Measure rebuilt output; the package contribution numbers above are not guaranteed savings or production transferred bytes.

Additional Context

Observed on a local Dify 1.17.1 development branch based on 06e473015a9a1abb71da88ac0a0e92d96a992008, with local DevTools integration patches; Vinext 1.0.0-beta.10, Vite+ core 0.3.2, Node 24.21.0. This report describes that branch/lockfile state and should be rechecked against current main before making changes. Related URL-state consolidation: #30180.

Activity

  1. Souravrajvi0 commented on Sep 18, 2026

    @Souravrajvi0
    Contributor

    Opened #42517 — adds catalog next as a devDependency on nuqs-jotai so nuqs dedupes to one Next 16.3.5 peer context with web.

  2. Souravrajvi0 commented on Sep 18, 2026

    @Souravrajvi0
    Contributor

    Following up on #42517 with the acceptance-criteria checklist from this issue:

    Peer / lockfile

    • Added catalog next as a devDependency in packages/nuqs-jotai so dev-time nuqs resolves against the same Next peer as dify-web (catalog 16.3.5).
    • Regenerated pnpm-lock.yaml: removed the stray next@16.3.4 importer; lockfile now has a single nuqs@2.10.1(next@16.3.5…) peer context.

    Single runtime instance

    • Before: packages/nuqs-jotai/node_modules/nuqs → nuqs@2.10.1 + next@16.3.4, web/node_modules/nuqs → nuqs@2.10.1 + next@16.3.5.
    • After: both symlinks target the same .pnpm/nuqs@2.10.1_next@16.3.5_… package root.

    Behavior / tests

    • pnpm --filter nuqs-jotai test run — 44 passed
    • pnpm --filter nuqs-jotai type-check — passed

    Vinext build

    • Ran pnpm run build:vinext in web; client build stages completed on this VM. The full command hit a heap OOM during the final SSR pass (environment memory limit) — did not re-run Rolldown client package-graph byte comparison here; happy to add that if you have a preferred command/output from your local setup.

    Let me know if you prefer aligning via peerDependencyRules / overrides instead of an explicit next devDependency on nuqs-jotai.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions