Skip to content

[Bug]: "TypeError: defaultSearchParams.keys() is not iterable" in Firefox Addon content scripts #10618

Closed
@smithki

Description

@smithki

What version of React Router are you using?

6.11.0

Steps to Reproduce

There is a known issue in Firefox — still open after 9 years — that manifests in the following TypeError when using React Router DOM in the content scripts of a Firefox Addon:

Screenshot 2023-06-16 at 4 26 29 PM
TypeError: defaultSearchParams.keys() is not iterable[dom.ts:100:40](moz-extension://ea565e18-3799-46da-aa12-608dc044d7e7/node_modules/react-router-dom/dom.ts)
    getSearchParamsForLocation dom.ts:100

Here's a link to the relevant Bugzilla ticket: https://bugzilla.mozilla.org/show_bug.cgi?id=1023984

Expected Behavior

useSearchParams doesn't not produce an error.

Actual Behavior

React experiences a fatal error at runtime, including recursive "Invalid hook call" warnings. This is a showstopper for anyone who wants to use React Router DOM in a web extension (for my case, paired with MemoryRouter to simplify routing for UIs that are injected into content scripts).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions