The following are lists of the notable changes included with each release.
This is intended to help keep people informed about notable changes between
versions, as well as provide a rough history. Each item is prefixed with
one of the following labels: Added
, Changed
, Deprecated
,
Removed
, Fixed
, Security
. We also use Semantic Versioning
to manage the versions of this gem so
that you can set version constraints properly.
- WIP
v2.0.5 - 2024-04-24
Fixed
: Warning aboutBatchLoader
usage insteadBatchLoader::GraphQL
in GraphQL. #94
v2.0.4 - 2024-04-02
Fixed
: Chaining#execute_field
trace calls. #93
v2.0.3 - 2024-03-25
Fixed
:Schema.tracer(...)
GraphQL deprecation warning by making it compatible with.trace_with(...)
. #91
v2.0.2 - 2023-11-22
Fixed
: Compatibility with Ruby 3 kwargs. #80
v2.0.1 - 2021-02-18
v2.0.0 - 2021-02-18
Removed
: Support for GraphQL version <= 1.7. #75
v1.5.0 - 2020-04-20
Please use BatchLoader::GraphQL.for
instead:
field :user, UserType, null: false
def user # resolver
BatchLoader::GraphQL.for...
end
Or wrap a BatchLoader instance with BatchLoader::GraphQL.wrap
:
field :user, UserType, null: false
def user # resolver
BatchLoader::GraphQL.wrap(lazy_user)
end
def lazy_user
BatchLoader.for...
end
v1.4.1 - 2019-05-24
Fixes
: Does not allow mutating and corrupting a list of items in abatch
block. #46
v1.4.0 - 2019-04-29
Added
: newreplace_methods
argument toBatchLoader#batch
to allow control overdefine_method
calls. #45
v1.3.0 - 2019-02-01
Added
:BatchLoader::GraphQL.for
to make it compatible withgraphql
gem versions>= 1.8.7
. #30
v1.2.2 - 2018-12-03
Fixed
: Identify item bykey
object instead ofkey
string representation. #27
v1.2.1 - 2017-12-16
Fixed
: Do not depend onmethod_missing
forrespond_to?
. #14
v1.2.0 - 2017-11-16
Added
:key
argument for theBatchLoader#batch
method. #12
v1.1.1 - 2017-11-06
Fixed
:loader
, made it thread-safe again. #10
v1.1.0 - 2017-11-02
Added
:default_value
override option. #8Added
:loader.call {}
block syntax, for memoizing repeat calls to the same item. #8
v1.0.4 - 2017-10-12
Fixed
: Fix arity bug inrespond_to?
#3
v1.0.3 – 2017-09-18
Fixed
: auto syncing performance up to 30x times compared to v1.0.2. RubyForwardable
withdef_delegators
is too slow.Fixed
: GraphQL performance up to 3x times by disabling auto syncing in favor of syncing with graphql-rubylazy_resolve
.Added
: more benchmarks.
v1.0.2 – 2017-09-14
Added
:BatchLoader#inspect
method because of Pry, which swallows errors.
# Before:
require 'pry'
binding.pry
pry(main)> result = BatchLoader.for(1).batch { |ids, loader| raise "Oops" };
pry(main)> result # Pry called result.inspect and swallowed the "Oops" error
# => #<BatchLoader:0x8>
pry(main)> result.id
# => NoMethodError: undefined method `id' for nil:NilClass
# After:
require 'pry'
binding.pry
pry(main)> result = BatchLoader.for(1).batch { |ids, loader| raise "Oops" };
pry(main)> result
# => #<BatchLoader:0x140653946335160>
pry(main)> result.id
# => RuntimeError: Oops
Added
: benchmarks.Fixed
: cachingnil
s for not loaded values only after successful#batch
execution.Changed
: internal implementation with RubyForwardable
, don't delegate methods likeobject_id
and__send__
.
v1.0.1 – 2017-09-03
Fixed
: loadingBatchLoader
by requiringSet
.
v1.0.0 – 2017-08-21
Removed
:BatchLoader.sync!
andBatchLoader#sync
. Now syncing is done implicitly when you call any method on the lazy object.
def load_user(user_id)
BatchLoader.for(user_id).batch { ... }
end
# Before:
users = [load_user(1), load_user(2), load_user(3)]
puts BatchLoader.sync!(users) # or users.map!(&:sync)
# After:
users = [load_user(1), load_user(2), load_user(3)]
puts users
Removed
:BatchLoader#load
. Useloader
lambda instead:
# Before:
BatchLoader.for(user_id).batch do |user_ids, batch_loader|
user_ids.each { |user_id| batch_loader.load(user_id, user_id) }
end
# After:
BatchLoader.for(user_id).batch do |user_ids, loader|
user_ids.each { |user_id| loader.call(user_id, user_id) }
end
Changed
: useBatchLoader::GraphQL
in GraphQL schema:
# Before:
Schema = GraphQL::Schema.define do
# ...
lazy_resolve BatchLoader, :sync
end
# After:
Schema = GraphQL::Schema.define do
# ...
use BatchLoader::GraphQL
end
v0.3.0 – 2017-08-03
Added
:BatchLoader::Executor.clear_current
to clear cache manually.Added
: tests and description how to use with GraphQL.
v0.2.0 – 2017-08-02
Added
:cache: false
option to disable caching for resolved values.Added
:BatchLoader::Middleware
to clear cache between Rack requests.Added
: more docs and tests.
v0.1.0 – 2017-07-31
Added
: initial functional version.