Simplify error handling in wardrobe v2

This commit is contained in:
Emi Matchu 2025-11-02 07:58:30 +00:00
parent a00d57bcbb
commit 0651a2871c
3 changed files with 5 additions and 6 deletions

View file

@ -102,7 +102,7 @@ class OutfitsController < ApplicationController
# Preload the manifests for all visible layers, so they load efficiently # Preload the manifests for all visible layers, so they load efficiently
# in parallel rather than sequentially when rendering # 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 render layout: false
end end

View file

@ -170,6 +170,8 @@ class Outfit < ApplicationRecord
end end
def visible_layers def visible_layers
return [] if pet_state.nil?
# TODO: This method doesn't currently handle alt styles! If the outfit has # 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 # 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 # filter items to only those with body_id=0. This isn't needed yet because

View file

@ -19,16 +19,13 @@
= turbo_frame_tag "outfit-editor" do = turbo_frame_tag "outfit-editor" do
.wardrobe-container .wardrobe-container
.outfit-preview-section .outfit-preview-section
- if @outfit.pet_state - if @pet_type.nil?
= outfit_viewer @outfit
- elsif @pet_type.nil?
.no-preview-message .no-preview-message
%p %p
We haven't seen this kind of pet before! Try a different species/color We haven't seen this kind of pet before! Try a different species/color
combination. combination.
- else - else
.no-preview-message = outfit_viewer @outfit
%p Loading...
.outfit-controls-section .outfit-controls-section
%h1 Customize your pet %h1 Customize your pet