Skip to content

render_hook transforms keys to strings, but leaves values as is #4085

@LostKobrakai

Description

@LostKobrakai

Environment

  • Elixir version (please paste the output of elixir -v):
Erlang/OTP 28 [erts-16.1] [source] [64-bit] [smp:14:14] [ds:14:14:10] [async-threads:1] [jit]

Elixir 1.19.1 (compiled with Erlang/OTP 28)
  • Phoenix and LiveView versions (mix deps | grep -w 'phoenix\|phoenix_live_view'):
* phoenix 1.8.3 (Hex package) (mix)
  locked at 1.8.3 (phoenix) 36169f95
* phoenix_live_view 1.1.19 (Hex package) (mix)
  locked at 1.1.19 (phoenix_live_view) d5ad357d
  • Operating system:
  • Windows
  • MacOS
  • Linux
  • Other (please specify):
  • Browsers (including version) you attempted to reproduce this bug on (the more the merrier):
None

Actual behavior

Render hook data is transformed to string keys, but not to a format you would be able to get from json decoding.

   assert render_hook(view, "add_item", %{
               product_family: :lights,
               catalog: "123",
               product_preset: "456",
               product_series: nil,
               location: %{}
             })

Inspected as received in the handle_event/3 callback:

%{
  "catalog" => "123",
  "location" => %{},
  "product_family" => :lights,
  "product_preset" => "456",
  "product_series" => nil
}

Expected behavior

The atom would be expected to become a string as well.

%{
  "catalog" => "123",
  "location" => %{},
  "product_family" => "lights",
  "product_preset" => "456",
  "product_series" => nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions