Skip to content

Can't use Effect with React Native #6252

@Suniron

Description

@Suniron

What version of Effect is running?

4.0.0-beta.70

What steps can reproduce the bug?

  • Create a bun monorepo with Effect for a backend server and a second app using React Native (Expo).
  • Try to fetch the Effect API by calling the code below from the useEffect of the component (a fetch works!):
const client = BackendClient(API_URL).pipe(Effect.provide(FetchHttpClient.layer));

const helloAtom = Atom.make(() =>
  client.pipe(
    Effect.flatMap((c) => c.Hello.hello()),
    Effect.map((greeting) => greeting.message),
  ),
);

What is the expected behavior?

The message from the API is correctly received using the Effect API client.

What do you see instead?

entry.bundle?platfor…ompiler=true:174429 Uncaught TypeError: Cannot read properties of undefined (reading 'reasons')
    at causePartition (entry.bundle?platfor…iler=true:174429:30)
    at Object.causeSquash (entry.bundle?platfor…iler=true:174436:25)
    at useAtomSuspense (entry.bundle?platfor…iler=true:300060:19)
    at HelloMessage (entry.bundle?platfor…iler=true:148464:57)
    at Object.react_stack_bottom_frame (entry.bundle?platfor…piler=true:18221:20)
    at renderWithHooks (entry.bundle?platfor…mpiler=true:9094:22)
    at updateFunctionComponent (entry.bundle?platfor…piler=true:10483:19)
    at beginWork (entry.bundle?platfor…piler=true:11052:18)
    at runWithFiberInDEV (entry.bundle?platfor…mpiler=true:5571:70)
    at performUnitOfWork (entry.bundle?platfor…piler=true:13479:95)
    at workLoopSync (entry.bundle?platfor…piler=true:13374:40)
    at renderRootSync (entry.bundle?platfor…mpiler=true:13359:9)
    at performWorkOnRoot (entry.bundle?platfor…piler=true:13032:35)
    at performWorkOnRootViaSchedulerTask (entry.bundle?platfor…mpiler=true:14134:7)
    at MessagePort.performWorkUntilDeadline (entry.bundle?platfor…piler=true:20073:48)

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions