Skip to content

Commit

Permalink
fix: deserialize Hashes as HWIA
Browse files Browse the repository at this point in the history
For backward-compatibility
  • Loading branch information
palkan committed Mar 23, 2024
1 parent 5a38a5e commit 25a8be3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/anycable/rails/channel_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def #{name}
return @#{name} if instance_variable_defined?(:@#{name})
return unless anycabled?
val = __istate__["#{name}"]
raw_val = __istate__["#{name}"]
val = raw_val.present? ? AnyCable::Serializer.deserialize(JSON.parse(raw_val)) : nil
@#{name} = val.present? ? AnyCable::Serializer.deserialize(JSON.parse(val)) : nil
@#{name} = val.try(:with_indifferent_access) || val
end
def #{name}=(val)
Expand Down

0 comments on commit 25a8be3

Please sign in to comment.