Skip to content

Commit 9760cb9

Browse files
linting
1 parent ae5c92f commit 9760cb9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

react_on_rails_pro/app/helpers/react_on_rails_pro_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def handle_stream_cache_hit(component_name, raw_options, auto_load_bundle, cache
266266

267267
def handle_stream_cache_miss(component_name, raw_options, auto_load_bundle, view_cache_key, &block)
268268
cache_aware_options = raw_options.merge(
269-
on_complete: ->(chunks) {
269+
on_complete: lambda { |chunks|
270270
Rails.cache.write(view_cache_key, chunks, raw_options[:cache_options] || {})
271271
}
272272
)
@@ -308,15 +308,15 @@ def run_stream_inside_fiber(on_complete:)
308308

309309
# Create a variable to hold the first chunk for synchronous return
310310
first_chunk_var = Async::Variable.new
311-
all_chunks = [] if on_complete # Only collect if callback provided
311+
all_chunks = [] if on_complete # Only collect if callback provided
312312

313313
# Start an async task on the barrier to stream all chunks
314314
@async_barrier.async do
315315
stream = yield
316316
is_first = true
317317

318318
stream.each_chunk do |chunk|
319-
all_chunks << chunk if on_complete # Collect for callback
319+
all_chunks << chunk if on_complete # Collect for callback
320320

321321
if is_first
322322
# Store first chunk in variable for synchronous access
@@ -332,7 +332,7 @@ def run_stream_inside_fiber(on_complete:)
332332
first_chunk_var.value = nil if is_first
333333

334334
# Call callback with all chunks when streaming completes
335-
on_complete&.call(all_chunks) if on_complete
335+
on_complete&.call(all_chunks)
336336
end
337337

338338
# Wait for and return the first chunk (blocking)

react_on_rails_pro/spec/dummy/spec/helpers/react_on_rails_pro_helper_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
RequestDetails = Struct.new(:original_url, :env)
1010

11+
# rubocop:disable RSpec/InstanceVariable
12+
1113
# This module is created to provide stub methods for `render_to_string` and `response`
1214
# These methods will be mocked in the tests to prevent "<object> does not implement <method>" errors
1315
# when these methods are called during testing.
@@ -387,7 +389,7 @@ def mock_request_and_response(mock_chunks = chunks, count: 1)
387389
expect(initial_result).to include(wrapped)
388390
end
389391
expect(initial_result).not_to include("More content", "Final content")
390-
# Note: With async architecture, chunks are consumed in background immediately,
392+
# NOTE: With async architecture, chunks are consumed in background immediately,
391393
expect(chunks_read.count).to eq(3)
392394
end
393395

@@ -736,7 +738,7 @@ def render_cached_random_value(cache_key)
736738
@main_output_queue.close
737739

738740
# Drain the queue
739-
while (chunk = @main_output_queue.dequeue)
741+
while @main_output_queue.dequeue
740742
# Just consume all remaining chunks
741743
end
742744
end
@@ -815,3 +817,4 @@ def render_cached_random_value(cache_key)
815817
end
816818
end
817819
end
820+
# rubocop:enable RSpec/InstanceVariable

0 commit comments

Comments
 (0)