From 773bd8b692e7a9bf32df19372efe848066a1f305 Mon Sep 17 00:00:00 2001 From: David Crespo <david.crespo@oxidecomputer.com> Date: Wed, 11 Sep 2024 10:05:09 -0500 Subject: [PATCH] don't need to sort firewall rules for create form --- app/forms/firewall-rules-create.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/app/forms/firewall-rules-create.tsx b/app/forms/firewall-rules-create.tsx index dcde1aa133..87203f2973 100644 --- a/app/forms/firewall-rules-create.tsx +++ b/app/forms/firewall-rules-create.tsx @@ -5,10 +5,8 @@ * * Copyright Oxide Computer Company */ -import { useMemo } from 'react' import { useForm } from 'react-hook-form' import { useNavigate, useParams, type LoaderFunctionArgs } from 'react-router-dom' -import * as R from 'remeda' import { apiQueryClient, @@ -82,13 +80,8 @@ export function CreateFirewallRuleForm() { }, }) - const { data: vpcFirewallRules } = usePrefetchedApiQuery('vpcFirewallRulesView', { - query: vpcSelector, - }) - const existingRules = useMemo( - () => R.sortBy(vpcFirewallRules.rules, (r) => r.priority), - [vpcFirewallRules] - ) + const { data } = usePrefetchedApiQuery('vpcFirewallRulesView', { query: vpcSelector }) + const existingRules = data.rules // The :rule path param is optional. If it is present, we are creating a // rule from an existing one, so we find that rule and copy it into the form