Skip to content

BUG | useUrlSearchParams | writeMode: 'push' breaks browser history navigation #4968

@pterror

Description

@pterror

Describe the bug

useUrlSearchParams(undefined, { writeMode: "push" });

breaks browser history navigation - this is because the callback of the pausableWatch gets run by the write call in onChange, which in turn breaks browser history

Reproduction

https://stackblitz.com/edit/vitejs-vite-epnsxtm6?file=src%2FApp.vue

System Info

System:
    OS: Linux 6.15 cpe:/o:nixos:nixos:25.11 25.11 (Xantusia)
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 17.54 GB / 30.69 GB
    Container: Yes
    Shell: 4.0.2 - /run/current-system/sw/bin/fish
  Binaries:
    Node: 20.19.3 - /nix/store/lz7iav1hd92jbv44zf2rdd7b2mj23536-nodejs-20.19.3/bin/node
    Yarn: 1.22.22 - /nix/store/v3gr7h5266sgf8ylg8x7jxw81z56sf3w-corepack-nodejs-22.17.0/bin/yarn
    npm: 10.8.2 - /nix/store/lz7iav1hd92jbv44zf2rdd7b2mj23536-nodejs-20.19.3/bin/npm
    pnpm: 10.11.1 - /nix/store/v3gr7h5266sgf8ylg8x7jxw81z56sf3w-corepack-nodejs-22.17.0/bin/pnpm
  npmPackages:
    @vueuse/core: ^13.5.0 => 13.5.0 
    vue: ^3.5.17 => 3.5.17

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas pr

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions