Here’s an example from an older thread if you would rather query the db only after connected?(socket) == true. The entire thread is well worth the read and explains the context behind LiveView’s lifecycle architecture/design.
connected?(socket) == true