As asked
You are building a LiveView dashboard with filters, charts, and realtime updates. What state belongs in the socket assigns, what belongs in the URL, and what belongs in the database?
Sample answer outline
Durable business state belongs in the database, shareable navigation state such as filters belongs in URL params, and ephemeral view state belongs in assigns. The answer should cover mount versus handle_params, reconnect behaviour, and how PubSub updates are merged without overwriting a user's current filters. Expensive chart data should be paged or summarised rather than stored wholesale in the socket. The interviewer wants to hear that LiveView is server stateful and therefore memory per connection matters. Weak answers treat LiveView like React with a socket bolted on and forget reconnects, browser history, and process memory.
Expect these follow-ups
- How do you make the dashboard deep-linkable?
- What happens to assigns during a reconnect?
- How do you prevent one user connection from consuming too much memory?