mswjs/msw

Addition of Boundary() to setupServer() in react-native with help of AsyncLocalStorage alternative in RN

pratyushbh opened this issue · 1 comments

Scope

Adds a new behavior

Compatibility

  • This is a breaking change

Feature description

To add a Boundary() method to the setupServer() method in React native to isolate the behaviour of network just like in nodeJS ,since async_hook is not available in react-native, there's no AsyncLocalStorage() in react native like node.js, but there are some async local storage packages in react native that we can use or something else.

Hi, @pratyushbh. Thanks for raising this.

I would love to add server.boundary() to React Native but it requires the AsyncLocalStorage API to work. There is no means to implement that API manually. It integrates into the event loop (and internal Node.js hooks) and cannot be provided from the userland.

We need to wait until React Native adds support for AsyncLocalStorage officially.