README.md in graphql-relay-0.6.2 vs README.md in graphql-relay-0.7.0
- old
+ new
@@ -124,10 +124,18 @@
comments
}
end
```
+#### Maximum Page Size
+
+You can limit the number of results with `max_page_size:`:
+
+```ruby
+connection :featured_comments, CommentType.connection_type, max_page_size: 50
+```
+
#### Connection types
You can customize a connection type with `.define_connection`:
```ruby
@@ -144,13 +152,13 @@
#### Connection objects
Maybe you need to make a connection object yourself (for example, to return a connection type from a mutation). You can create a connection object like this:
-```
-items = ... # your collection objects
-args = {} # stub out arguments for this connection object
+```ruby
+items = [...] # your collection objects
+args = {} # stub out arguments for this connection object
connection_class = GraphQL::Relay::BaseConnection.connection_for_items(items)
connection_class.new(items, args)
```
`.connection_for_items` will return RelationConnection or ArrayConnection depending on `items`, then you can make a new connection
@@ -308,10 +316,9 @@
2. http://mgiroux.me/2015/getting-started-with-rails-graphql-relay/
3. http://mgiroux.me/2015/uploading-files-using-relay-with-rails/
## Todo
-- Add a `max_page_size` config for connections?
- Refactor some RelationConnection issues:
- fix [unbounded count in page info](https://github.com/rmosolgo/graphql-relay-ruby/blob/88b3d94f75a6dd4c8b2604743108db31f66f8dcc/lib/graphql/relay/base_connection.rb#L79-L86), [details](https://github.com/rmosolgo/graphql-relay-ruby/issues/1)
## More Resources