Skip to content

Commit

Permalink
Merge pull request rails#50775 from mockdeep/rf-thread_fix
Browse files Browse the repository at this point in the history
Fix threading issue with strict locals
  • Loading branch information
rafaelfranca authored Jan 18, 2024
2 parents 8e0a702 + 929f9fd commit 5703463
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions actionview/lib/action_view/unbound_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ def bind_locals(locals)
# while holding the lock.
template = (@templates[normalized_locals] ||= build_template(normalized_locals))

# This may have already been assigned, but we've already de-dup'd so
# reassignment is fine.
@templates[locals.dup] = template

if template.strict_locals?
# Under strict locals, we only need one template.
# This replaces the @templates Concurrent::Map with a hash which
# returns this template for every key.
@templates = Hash.new(template).freeze
else
# This may have already been assigned, but we've already de-dup'd so
# reassignment is fine.
@templates[locals.dup] = template
end
end
end
Expand Down

0 comments on commit 5703463

Please sign in to comment.