fix: build request URL via string concatenation instead of assigning to URL.search#27
Open
omar-diop wants to merge 1 commit intooramasearch:mainfrom
Open
fix: build request URL via string concatenation instead of assigning to URL.search#27omar-diop wants to merge 1 commit intooramasearch:mainfrom
omar-diop wants to merge 1 commit intooramasearch:mainfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using
@orama/corein a React Native app powered by the Hermes engine,both
eventSource()andgetResponse()inClientthrow 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:URLobject to a string viaremoteURL.toString()?or&as separator depending on whether the URL already contains query paramsURLobject properties and works consistently across all JavaScript runtimes (browsers, Node.js, Hermes/React Native).