$ the-wire · showcase
Formatter bugs that changed program meaning, and a LiveView assign that always fired
By RepoJournal · Filed · About Elixir & Phoenix · Composed from the cited sources · methodology
Today's Elixir commits are formatter correctness fixes: two of them were rewriting expressions into code that parsed differently, plus a LiveView wrapper that resent global attributes on every render.
Remove quadratic complexity from internal APIs elixir-lang/elixir
José Valim removed quadratic complexity from internal APIs, which is the kind of change that only shows up as slowness on large inputs rather than as a test failure. It lands on main, not in a tagged release, so it reaches you on your next Elixir upgrade.
Keep parens on anonymous function calls with do-end blocks elixir-lang/elixir
The formatter printed anonymous calls with `:skip_if_do_end`, so `callback.(conn, opts) do` came out as `callback. conn, opts do`, which does not parse, and `fun.(a).(b) do c end` could parse to something different entirely. Anonymous call parens are now `:required`, matching the `call(call)(arguments)` clause below it.
Keep parens on unary operators on the left of in elixir-lang/elixir
`!!x in y` was formatted as `!(!x in y)`, which the parser reads as `!(!(x in y))`, a different result; it now formats as `!((!x) in y)`, with the same fix applied to `not` and to `Macro.to_string/1`. `!x not in y` was never affected and is left alone.
Only mark global attributes as changed when they change phoenixframework/phoenix_live_view
A component declaring `attr :rest, :global` had its wrapper assign the caller's globals with `Phoenix.Component.assign/3`, and that key is never in `__given__`, so `assign/3` always flagged it changed. Every expression reading those attributes was resent on re-render even when no global attribute changed; the fix marks them changed only on an actual change.
Retry focus if it did not move phoenixframework/phoenix_live_view
In the client, focus is now retried when it did not move, addressing the case tracked in the linked issue. Smaller items alongside it: a spec correction for `Route.build/14` in Phoenix and a docs fix for `Join.escape/3` in Ecto.