Skip to content

fix: build request URL via string concatenation instead of assigning to URL.search#27

Open
omar-diop wants to merge 1 commit intooramasearch:mainfrom
omar-diop:fix/react-native-url
Open

fix: build request URL via string concatenation instead of assigning to URL.search#27
omar-diop wants to merge 1 commit intooramasearch:mainfrom
omar-diop:fix/react-native-url

Conversation

@omar-diop
Copy link

Problem

When using @orama/core in a React Native app powered by the Hermes engine,
both eventSource() and getResponse() in Client throw a runtime error.

The root cause is this pattern:

remoteURL.search = new URLSearchParams(params).toString()

In Hermes, the URL polyfill exposes search as read-only (getter only, no setter), so the assignment throws. In browsers and Node.js search is writable, which is why the issue only surfaces on React Native.

Solution

Instead of mutating remoteURL.search, we:

  • Convert the URL object to a string via remoteURL.toString()
  • Append the query string manually using template literals, choosing ? or & as separator depending on whether the URL already contains query params
  • This avoids touching any URL object properties and works consistently across all JavaScript runtimes (browsers, Node.js, Hermes/React Native).

…to URL.search

Hermes (React Native) exposes URL.search as read-only, causing a runtime
error when assigning to it. This replaces the URL.search assignment in
eventSource() and getResponse() with string-based URL construction,
ensuring compatibility across all JavaScript runtimes.
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

Comments