[REQUEST] support vercel edge functions by default
- Dominant language
- JavaScript
- Stars
- 13.4k
- Forks
- 518
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 2
Description
## What problem are you trying to solve?
support the [vercel edge runtime ](https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime)for dataloaders without workaround. see discussion here https://github.com/vercel/next.js/issues/44711 (edge does not support `process.nextTick`, which is being checked in the `Dataloader` package)
right now, you have to pass in the `batchScheduleFn` with a setTimeout to the DataLoader to make the package work on the edge runtime like so
```
batchScheduleFn: (cb) => setTimeout(cb, 0),
```
but this might not be ideal? not totally sure what happens in this case, I would just worry about adding latency or breaking the batching with the setTimeout instead of relying on the default behavior (batching per execution context)
## Describe the solution you'd like
Dataloader should work in the edge runtime without having to pass in a `setTimeout`
## Describe alternatives you've considered
using the setTimeout workaround
## Additional context
nice to support edge functions so that you can have zero cold start graphql functions in a serverless environment
Contributor guide
Assessment
This issue has not been assessed yet.