---
title: "Stop mounting your LiveView twice"
url: https://daily.dev/posts/stop-mounting-your-liveview-twice-oa9xs3fdi
source_url: https://elixirdrops.net/d/9mrw2kg3
type: article
source: "ElixirStatus"
published: 2026-06-25T10:56:50.866Z
updated: 2026-06-25T10:57:15.508Z
tags: ["webdev", "performance", "elixir", "websocket", "liveview"]
reading_time: 26
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop mounting your LiveView twice

**[ElixirStatus](https://daily.dev/sources/elixirstatus)** · 26 min read · 0 upvotes · 0 comments

## Summary

Phoenix LiveView mounts twice on first page load — once for the static HTTP dead render and again when the WebSocket connects. The common fix of guarding data loads with `connected?/1` avoids double queries but breaks SEO, link previews, and no-JS fallback by leaving the dead render empty. This post explains why the double mount exists, what `connected?/1` actually costs, and introduces an experimental fork that parks the dead-render socket in a short-lived GenServer and redeems it on WebSocket connect — skipping the second mount entirely. The fork adds an `on_connect/1` callback for connection-only side effects (subscriptions, timers, presence) and provides migration patterns for data loads, connect params, and real-time data. The upstream Phoenix team is working on a more complete 'adoptable LiveViews' solution (issue #3551), but this fork serves as an interim stopgap.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://elixirdrops.net/d/9mrw2kg3>

## Similar posts on daily.dev

- [Phoenix LiveView widgets with hooks: a reusable pattern](https://daily.dev/posts/phoenix-liveview-widgets-with-hooks-a-reusable-pattern-ldf39mbva) · Curiosum · 0 upvotes · 0 comments
- [Watch: Exploring LiveView 1.2's server-composed JS commands, colocated CSS, and colocated hooks](https://daily.dev/posts/watch-exploring-liveview-1-2-s-server-composed-js-commands-colocated-css-and-colocated-hooks-h14hlfolz) · ElixirStatus · 0 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#performance](https://daily.dev/tags/performance), [#elixir](https://daily.dev/tags/elixir), [#websocket](https://daily.dev/tags/websocket), [#liveview](https://daily.dev/tags/liveview)

[View this post on daily.dev](https://daily.dev/posts/stop-mounting-your-liveview-twice-oa9xs3fdi)
