liveview-native / live_view_native

A framework for building native applications with Phoenix LiveView
https://native.live/
MIT License
458 stars 19 forks source link

List values are concatenated instead of encoded #134

Closed carson-katri closed 5 months ago

carson-katri commented 5 months ago

When passing a List to an attribute, the values are not JSON encoded, but merged into a single string:

selection = []
<List selection={@selection}>

This results in:

<List selection="">

Expected:

<List selection="[]">

When the list has values

selection = ["1", "2"]
<List selection={@selection}>

This results in:

<List selection="12">

Expected:

<List selection='["1", "2"]'>
bcardarella commented 5 months ago

Can you confirm if this is true with main? I just tried to reproduce and cannot.

Also, FWIW the 2nd example should encode as:

<List selection="[\"1\",\"2\"]"></List>
carson-katri commented 5 months ago

Using main of live_view_native and liveview-client-swiftui I still get:

<List selection="12">
</List>
bcardarella commented 5 months ago

This was a result of the consuming app having an overridden phoenix_live_view dependency that didn't include the upstream changes necessary to enable our special attribute handling. Once the next version of phoenix_live_view is cut we can remove the git refs and this will hopefully not be an issue again