Skip to content

Commit 674a461

Browse files
gsamokovarovEnvek
authored andcommitted
Better config.use_client_provided_uniq_id deprecation (#27)
Moving this warning to the invocation of `GraphQL::AnyCable.use` makes it issuable outside of Rails.
1 parent 0cff4fb commit 674a461

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/graphql-anycable.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
module GraphQL
1212
module AnyCable
1313
def self.use(schema, **options)
14+
if config.use_client_provided_uniq_id?
15+
warn "[Deprecated] Using client provided channel uniq IDs could lead to unexpected behaviour, " \
16+
"please, set GraphQL::AnyCable.config.use_client_provided_uniq_id = false or GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false, " \
17+
"and update the `#unsubscribed` callback code according to the latest docs."
18+
end
19+
1420
schema.use GraphQL::Subscriptions::AnyCableSubscriptions, **options
1521
end
1622

lib/graphql/anycable/railtie.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ class Railtie < ::Rails::Railtie
99
path = File.expand_path(__dir__)
1010
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
1111
end
12-
13-
config.after_initialize do
14-
if GraphQL::AnyCable.config.use_client_provided_uniq_id?
15-
warn "[Deprecated] Using client provided channel uniq IDs could lead to unexpected behaviour, " \
16-
"please, set GraphQL::AnyCable.config.use_client_provided_uniq_id = false or GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false, " \
17-
"and update the `#unsubscribed` callback code according to the latest docs."
18-
end
19-
end
2012
end
2113
end
2214
end

0 commit comments

Comments
 (0)