From ffcb8c6563b8f9699f91c89dd7f0d0bd744a150c Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:27:27 -0700 Subject: [PATCH] Minor cleanup --- src/widgets/romm/component.jsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/widgets/romm/component.jsx b/src/widgets/romm/component.jsx index 196d69873..ea9549f73 100644 --- a/src/widgets/romm/component.jsx +++ b/src/widgets/romm/component.jsx @@ -4,7 +4,8 @@ import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; -export const rommDefaultFields = ["platforms", "totalRoms", "saves", "states"]; +const ROMM_DEFAULT_FIELDS = ["platforms", "totalRoms", "saves", "states"]; +const MAX_ALLOWED_FIELDS = 4; export default function Component({ service }) { const { widget } = service; @@ -15,12 +16,9 @@ export default function Component({ service }) { return ; } - // Default fields if (!widget.fields?.length > 0) { - widget.fields = rommDefaultFields; - } - const MAX_ALLOWED_FIELDS = 4; - if (widget.fields?.length > MAX_ALLOWED_FIELDS) { + widget.fields = ROMM_DEFAULT_FIELDS; + } else if (widget.fields.length > MAX_ALLOWED_FIELDS) { widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS); }