Skip to content

feat: Add incremental delivery support for Relay connections#214

Open
jwaldrip wants to merge 4 commits intoabsinthe-graphql:mainfrom
gigsmart:gigmart/defer-stream-incremental-clean
Open

feat: Add incremental delivery support for Relay connections#214
jwaldrip wants to merge 4 commits intoabsinthe-graphql:mainfrom
gigsmart:gigmart/defer-stream-incremental-clean

Conversation

@jwaldrip
Copy link
Copy Markdown

@jwaldrip jwaldrip commented Sep 5, 2025

Absinthe Relay Incremental Delivery

Relay connection support for GraphQL @defer and @stream directives.

Overview

This package extends absinthe_relay to support incremental delivery with Relay-style connections. Stream edges incrementally while maintaining cursor consistency and proper connection structure throughout the streaming process.

Features

  • Relay Specification: Full compliance with Relay Cursor Connection spec
  • Cursor Consistency: Maintains proper cursor ordering during streaming
  • Connection Structure: Preserves pageInfo and connection metadata
  • Bidirectional Pagination: Supports forward and backward streaming
  • Error Resilience: Graceful handling of partial failures

Installation

This functionality is included when using both absinthe_relay and incremental delivery:

def deps do
  [
    {:absinthe, "~> 1.8"},
    {:absinthe_relay, "~> 1.5"}
  ]
end

Basic Usage

Schema Definition

defmodule MyApp.Schema do
  use Absinthe.Schema
  use Absinthe.Relay.Schema, :modern
  
  import_types Absinthe.Type.BuiltIns
  
  connection node_type: :post
  connection node_type: :user
  
  query do
    connection field :posts, node_type: :post do
      arg :category, :string
      
      resolve fn args, _ ->
        # Your existing connection resolver
        MyApp.Resolvers.list_posts(args)

## ⚠️ DEPENDENCY NOTICE
**This PR depends on absinthe-graphql/absinthe#1377**  
The main absinthe package must be merged first before this PR can be merged.

## Features
- Stream edges incrementally while maintaining cursor consistency
- Compatible with forward and backward pagination
- Maintains proper connection structure during streaming
- Preserves pageInfo accuracy throughout streaming

## Implementation
- `Absinthe.Relay.Incremental.Connection` - Streaming connection support
- Cursor consistency management
- Edge batching for efficient delivery

## Testing
- Pagination consistency tests
- Cursor ordering validation
- Connection structure integrity

## Breaking Changes
None - incremental delivery is opt-in and backward compatible.

🤖 Generated with Claude Code

jwaldrip and others added 4 commits September 5, 2025 14:43
Implements streaming support for Relay pagination:
- Stream edges incrementally while maintaining cursor consistency
- Compatible with forward and backward pagination
- Maintains proper connection structure during streaming

docs: Add comprehensive Relay incremental delivery documentation

- Relay connection streaming guide
- Cursor consistency documentation
- Client integration examples (React, Relay Modern)
- Performance optimization strategies

DEPENDS ON: absinthe package defer-stream-incremental branch must be merged first

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…y testing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…very

Point to gigsmart/absinthe branch gigmart/defer-stream-incremental
for testing the @defer and @stream directive implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jwaldrip
Copy link
Copy Markdown
Author

jwaldrip commented Feb 6, 2026

Checking in on this clean version of the incremental delivery support for Relay connections. This is a companion to absinthe#1377. Any feedback?

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.

1 participant