Skip to content

feat(useSearchParams): remove trailing question mark#561

Merged
molefrog merged 10 commits into
molefrog:v3from
zsugabubus:no-question-mark
May 18, 2026
Merged

feat(useSearchParams): remove trailing question mark#561
molefrog merged 10 commits into
molefrog:v3from
zsugabubus:no-question-mark

Conversation

@zsugabubus
Copy link
Copy Markdown
Contributor

No description provided.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@zsugabubus
Copy link
Copy Markdown
Contributor Author

Initial test failure seemed unrelated. I attempted to track it down and I found lot's of flaky tests. After a hundred bun test --randomize iterations I think I've managed to fix everything. Should I open a separate PR?

@molefrog
Copy link
Copy Markdown
Owner

molefrog commented Apr 6, 2026

hi @zsugabubus thanks for the PR!
could you summarise what was the issue you fixed here and the flaky tests?

@zsugabubus
Copy link
Copy Markdown
Contributor Author

I use useSearchParams hook to manage some state in the search string. Given /path?search=hello. When user clears the search input, I skip appending the search param because it looks dumb (/path?search=), so I just do a prev.delete("search") within the setter. However, the resulting URL will be /path? (I would expect /path) because the question mark remains there unconditionally.

In the added test, I set no search params and it would be https://wouter.dev/? without the modifications.

Regarding the tests, I saw symptoms of missing unmounts (e.g. multiple links/elements found), missing act warnings, and the most tricky was that a history.back() from a previous test could affect a later history.pushState+history.length check.

@zsugabubus
Copy link
Copy Markdown
Contributor Author

No, sorry. The most tricky was that bun test --seed (IIRC) is affected by file modification timestamp/inode number/directory listing order (???). So even though I had the seed number from --randomize or without randomization I just had a failing test, I saved the test file and the failure magically disappeared on the next run and I could get a completely new, unrelated error. It kept me a while until I realized it.

Comment thread packages/wouter/test/redirect.test.tsx
@molefrog molefrog merged commit 708c236 into molefrog:v3 May 18, 2026
3 checks passed
@zsugabubus zsugabubus deleted the no-question-mark branch May 18, 2026 22:30
@zsugabubus
Copy link
Copy Markdown
Contributor Author

Why did you choose merge commit? Do you think it is a good idea to bury my 10 LOC real modification under hundreds of unrelated changes?

@molefrog
Copy link
Copy Markdown
Owner

Why did you choose merge commit?

It was the default option, didn't think about it too much to be honest. Didn't seem like a big deal.
What is your suggestion?

@zsugabubus
Copy link
Copy Markdown
Contributor Author

What is your suggestion?

I don't think we can change it but my personal favorite is rebase/fast-forward (after I have nice commits).

Anyway, thanks for merging that's the only thing that really matters. :)

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.

2 participants