Skip to content

feat: add Relay data fetching with mock GraphQL server#69

Merged
acald-creator merged 2 commits into
mainfrom
feat/relay-data-fetching
Apr 13, 2026
Merged

feat: add Relay data fetching with mock GraphQL server#69
acald-creator merged 2 commits into
mainfrom
feat/relay-data-fetching

Conversation

@acald-creator
Copy link
Copy Markdown
Owner

Summary

  • Add rescript-relay 4.4.1 with PPX for GraphQL queries in ReScript
  • Bundle a graphql-yoga mock server at mock-server/ serving User and Post types
  • PostsPage fetches posts via a Relay query with React Suspense loading
  • App wrapped in RescriptRelayReact.Context.Provider
  • Relay compiler generates artifacts to src/__generated__/
  • bun run dev now starts ReScript watch + Rspack + mock GraphQL server concurrently

New files

  • mock-server/index.js — graphql-yoga with in-memory users/posts data
  • mock-server/schema.graphql — GraphQL schema (Query, Mutation, User, Post, Node)
  • relay.config.js — Relay compiler config
  • src/relay/RelayEnv.res — Relay environment with fetch function
  • src/__generated__/ — Relay compiler artifacts

Scripts

  • bun run dev:server — start mock GraphQL server on :4000
  • bun run relay — run Relay compiler
  • bun run relay:watch — watch mode

Test plan

  • bun run relay — compiles 1 query successfully
  • bun run res:build — 103 modules compiled, zero warnings
  • bun run build — production build succeeds
  • bun run test — all 18 tests pass

Closes #35

Add rescript-relay with a bundled graphql-yoga mock server serving
User and Post types. PostsPage fetches data via a Relay query with
Suspense loading. App wraps in RelayEnvironmentProvider. Includes
relay.config.js and generated Relay artifacts.

Closes #35
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rspack-rescript Ready Ready Preview, Comment Apr 13, 2026 7:22am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Warning

Rate limit exceeded

@acald-creator has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 21 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 21 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 431abf41-a42d-4a3b-9fc1-62cfc114d9ac

📥 Commits

Reviewing files that changed from the base of the PR and between 572204d and d9827e2.

⛔ Files ignored due to path filters (3)
  • bun.lockb is excluded by !**/bun.lockb
  • src/__generated__/PostsPageQuery_graphql.res is excluded by !**/__generated__/**
  • src/__generated__/RelaySchemaAssets_graphql.res is excluded by !**/__generated__/**
📒 Files selected for processing (10)
  • biome.json
  • mock-server/index.js
  • mock-server/schema.graphql
  • package.json
  • relay.config.js
  • rescript.json
  • rspack.config.js
  • src/App.res
  • src/pages/PostsPage.res
  • src/relay/RelayEnv.res
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/relay-data-fetching

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Use GRAPHQL_ENDPOINT env var (defaults to localhost:4000/graphql in
dev). Add RescriptReactErrorBoundary to PostsPage that shows a
helpful "server not running" message when the mock server is
unavailable (e.g. on Vercel deployment).
@acald-creator acald-creator merged commit b47530a into main Apr 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[spike] Research rescript-relay

1 participant