Performance: Login and logout flow
MEDIUM IMPACT
This affects page load speed and interaction responsiveness during user authentication.
def create user = User.find_by(email: params[:email]) if user&.authenticate(params[:password]) session[:user_id] = user.id respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace('login_form', partial: 'logged_in') } format.html { redirect_to root_path } end else flash.now[:alert] = 'Invalid credentials' render :new end end
def create user = User.find_by(email: params[:email]) if user&.authenticate(params[:password]) session[:user_id] = user.id redirect_to root_path else flash.now[:alert] = 'Invalid credentials' render :new end end
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full page reload on login/logout | High (full DOM rebuild) | 1+ (full layout) | High (full repaint) | [X] Bad |
| Partial DOM update with Turbo Streams | Low (targeted DOM changes) | 0-1 (localized layout) | Low (partial repaint) | [OK] Good |