liveview-native / liveview-native/live_view_native_stylesheet

JSON encoding fails on `attr` argument in `alert` modifier

Open
#90 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
12
Forks
7
PR merge metrics
No merged PRs in 30d

Description

When using the `alert` modifier with an `isPresented`:
```ex
alert(attr("title"), isPresented: attr("presented"), actions: :actions, message: :message)
```

Compilation fails with the following error:

```
** (ErlangError) Erlang error: {:unsupported_type, {:isPresented, {:__attr__, [file: "core_components.swiftui.ex", line: 1, module: "", source: "alert(attr(\"title\"), isPresented: attr(\"presented\"), actions: :actions, message: :message)"], "presented"}}}
(stdlib 6.1.2) json.erl:199: :json.do_encode/2
(stdlib 6.1.2) json.erl:244: :json.list_loop/2
(stdlib 6.1.2) json.erl:241: :json.do_encode_list/2
(stdlib 6.1.2) json.erl:244: :json.list_loop/2
(stdlib 6.1.2) json.erl:244: :json.list_loop/2
(stdlib 6.1.2) json.erl:241: :json.do_encode_list/2
(stdlib 6.1.2) json.erl:241: :json.do_encode_list/2
(stdlib 6.1.2) json.erl:257: :json."-do_encode_map/2-lc$^0/1-0-"/2
```

I don't think stylesheet compilation errors should ever prevent an app from compiling. Instead the styles should be ignored.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the alert modifier example using attr("presented") and trace the JSON encoding failure shown in the compiler error. Inspect the stylesheet compilation path to determine where this unsupported value is handled; done means the app compiles successfully and the affected styles are ignored instead of raising an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.