Skip to content

WarpDrive assumes browser APIs that break in non-DOM environments (React Native) #10428

@bymetasoft

Description

@bymetasoft

When trying to run WarpDrive inside a React Native environment (as part of an experiment), the current implementation fails because it directly accesses browser-specific globals like window.addEventListener and document.visibilityState.

TypeError: window.addEventListener is not a function
TypeError: Cannot read properties of undefined (reading 'visibilityState')
Missing DOMException

These occur inside:

React Native doesn’t have window or document, so these assumptions cause failures even though the rest ofWarp Drive (signals, store, request manager, etc.) works fine once the environment is polyfilled.

How other libraries solve this

TanStack solves this by exposing onlineManager and focusManager - https://tanstack.com/query/v5/docs/framework/react/react-native. You can then use your React Native libraries to update their states

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions