From 0651a2871c26df743859e652b99e694b29a25e48 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sun, 2 Nov 2025 07:58:30 +0000 Subject: [PATCH] Simplify error handling in wardrobe v2 --- app/controllers/outfits_controller.rb | 2 +- app/models/outfit.rb | 2 ++ app/views/outfits/new_v2.html.haml | 7 ++----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index c7cb687d..34b6e16c 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -102,7 +102,7 @@ class OutfitsController < ApplicationController # Preload the manifests for all visible layers, so they load efficiently # in parallel rather than sequentially when rendering - SwfAsset.preload_manifests(@outfit.visible_layers) if @outfit.pet_state + SwfAsset.preload_manifests(@outfit.visible_layers) render layout: false end diff --git a/app/models/outfit.rb b/app/models/outfit.rb index 98b38744..cc368184 100644 --- a/app/models/outfit.rb +++ b/app/models/outfit.rb @@ -170,6 +170,8 @@ class Outfit < ApplicationRecord end def visible_layers + return [] if pet_state.nil? + # TODO: This method doesn't currently handle alt styles! If the outfit has # an alt_style, we should use its layers instead of pet_state layers, and # filter items to only those with body_id=0. This isn't needed yet because diff --git a/app/views/outfits/new_v2.html.haml b/app/views/outfits/new_v2.html.haml index e683238a..bee6327a 100644 --- a/app/views/outfits/new_v2.html.haml +++ b/app/views/outfits/new_v2.html.haml @@ -19,16 +19,13 @@ = turbo_frame_tag "outfit-editor" do .wardrobe-container .outfit-preview-section - - if @outfit.pet_state - = outfit_viewer @outfit - - elsif @pet_type.nil? + - if @pet_type.nil? .no-preview-message %p We haven't seen this kind of pet before! Try a different species/color combination. - else - .no-preview-message - %p Loading... + = outfit_viewer @outfit .outfit-controls-section %h1 Customize your pet