-
Couldn't load subscription status.
- Fork 24.9k
Open
Labels
Issue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.This issue can be reproduced in Snack or an attached project.Resolution: PR SubmittedA pull request with a fix has been provided.A pull request with a fix has been provided.
Description
Description
When a URL object already contains parameters, adding or overwriting parameters via the url.searchParams or url.search attributes does not work correctly.
Steps to reproduce
const url = new URL('https://example.com/api/data?foo=bar&baz=qux');
url.searchParams.set('foo', 'newFoo');
url.searchParams.set('test', '12345');
console.log(url.toString());
// expected output: https://example.com/api/data/?foo=newFoo&baz=qux&test=12345
// actual output: https://example.com/api/data?foo=bar&baz=qux&foo=newFoo&baz=qux&test=12345
url.search = 'foo=overwritten&hello=world';
console.log(url.toString());
// expected output: https://example.com/api/data/?foo=overwritten&hello=world
// actual output: https://example.com/api/data?foo=bar&baz=qux&foo=newFoo&baz=qux&test=12345React Native Version
0.82.1
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26100
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Memory: 18.19 GB / 31.84 GB
Binaries:
Node:
version: 20.19.4
path: C:\Programme_Emil\node-v20.19.4-win-x64\node.EXE
Yarn:
version: 1.22.22
path: C:\Programme_Emil\node-v20.19.4-win-x64\yarn.CMD
npm:
version: 10.8.2
path: C:\Programme_Emil\node-v20.19.4-win-x64\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "23"
- "28"
- "30"
- "31"
- "33"
- "34"
- "35"
- "36"
Build Tools:
- 28.0.3
- 30.0.2
- 30.0.3
- 33.0.0
- 34.0.0
- 35.0.0
- 35.0.1
- 36.0.0
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio:
- 17.0.31912.275 (Visual Studio Community 2022)
Languages:
Java:
version: 17.0.2
path: C:\Programme_Emil\jdk-17\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.1
wanted: 19.1.1
react-native:
installed: 0.82.1
wanted: 0.82.1
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
n/a
MANDATORY Reproducer
https://github.com/EmilJunker/ReactNativeUrlSearchParamsBug
Screenshots and Videos
No response
migueldaipre
Metadata
Metadata
Assignees
Labels
Issue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.This issue can be reproduced in Snack or an attached project.Resolution: PR SubmittedA pull request with a fix has been provided.A pull request with a fix has been provided.