$ the-wire · showcase
LiveView flash age 1000x too long, plus IEx autocomplete crash fix
By RepoJournal · Filed · About Elixir & Phoenix
Two fixes land in phoenix_live_view and elixir, correcting a 1000x flash token age error, non-idempotent disconnected callbacks, an IEx crash on incomplete UTF-8, and Ecto's exists semantics.
phoenix_live_view's flash verification used a max age of 60000 seconds instead of 60 when it passed `:timer.seconds(60)` to `Phoenix.Token.verify/4`, which expects seconds [1]. That meant a signed flash token remained valid for nearly 17 hours, not the intended 1 minute. The unit fix was assisted by Codex CLI:GPT 6 Astra [2], which is not a human reviewer you should trust [2].
Two LiveView behavior fixes: `Utils.verify_flash` now uses 60 seconds for max age, and `hook.disconnected()` is guarded so it fires once per disconnection, symmetric with `__reconnected()`, preventing repeated calls on persistent connection errors [3]. The push events diff simplifies construction of the events map, removing an unreachable falsy branch [4], and JS push options are no longer mutated, so hooks reusing an opts object across two `push()` calls behave correctly [5].
In elixir-land, IEx's autocomplete crashed with `UnicodeConversionError` when completion candidates shared an incomplete UTF-8 codepoint, such as map keys or function names [6]; the fix handles that crash. Separate fixes address `IEx.h/1` introspection for macros [7]. Ecto fixed `exists?` semantics for query combinations by wrapping in a subquery instead of rewriting to `SELECT 1`, preserving the original query form for set membership [8].
Action items
- → Upgrade to a version of phoenix_live_view containing the flash age fix before your next deploy. phoenixframework/phoenix_live_view [immediate]
- → Verify your LiveView JS hooks do not rely on mutation of push options. phoenixframework/phoenix_live_view [plan]
- → Watch for the Ecto fix to reach your installed version if you use exists? with unions or subqueries. elixir-ecto/ecto [monitor]
References
- [1] Fix max flash age unit in Utils.verify_flash (#4429) ↗ phoenixframework/phoenix_live_view
- [2] Fix max flash age unit in Utils.verify_flash ↗ phoenixframework/phoenix_live_view
- [3] Guard hook disconnected lifecycle callback ↗ phoenixframework/phoenix_live_view
- [4] Simplify push events diff (#4427) ↗ phoenixframework/phoenix_live_view
- [5] Avoid mutating JS push options ↗ phoenixframework/phoenix_live_view
- [6] Fix IEx incomplete codepoint autocomplete crash (#15864) ↗ elixir-lang/elixir
- [7] Fix IEx.h/1 macro spec introspection (#15863) ↗ elixir-lang/elixir
- [8] Fix `exists?` semantics for query combinations ↗ elixir-ecto/ecto